2002-01-17 23:49:08 +03:00
|
|
|
#
|
2002-01-19 03:21:43 +03:00
|
|
|
# A more complex test case
|
2002-01-17 23:49:08 +03:00
|
|
|
#
|
2013-10-18 19:25:49 +04:00
|
|
|
cmake_minimum_required(VERSION 2.4)
|
2012-08-13 21:47:32 +04:00
|
|
|
project (Complex)
|
2001-08-23 21:57:45 +04:00
|
|
|
|
2008-03-21 01:25:59 +03:00
|
|
|
# Try setting a new policy. The IF test is for coverage.
|
2012-08-13 21:47:32 +04:00
|
|
|
if(POLICY CMP0003)
|
|
|
|
cmake_policy(SET CMP0003 NEW)
|
2008-08-18 17:53:06 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
cmake_policy(GET CMP0003 P3)
|
|
|
|
if(NOT "${P3}" STREQUAL "NEW")
|
|
|
|
message(FATAL_ERROR "cmake_policy(GET) did not report NEW!")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
|
|
|
endif()
|
2008-03-21 01:25:59 +03:00
|
|
|
|
2009-03-16 23:55:58 +03:00
|
|
|
# Test building without per-rule echo lines in Makefiles.
|
2012-08-13 21:47:32 +04:00
|
|
|
set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
|
2009-03-16 23:22:19 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CPACK_SOURCE_IGNORE_FILES "~$;\\.cvsignore$;^C:/hoffman/My Builds/testcase.*/CVS/;^C:/hoffman/My Builds/testcase.*/\\.svn/;^C:/hoffman/My Builds/testcase.*/sweigart/;^C:/hoffman/My Builds/testcase/www/eospaper/solution/eos2001/;^C:/hoffman/My Builds/testcase/www/eospaper/solution/opal_tables_new/;^C:/hoffman/My Builds/testcase/COPYING$;^C:/hoffman/My Builds/testcase/INSTALL$;^C:/hoffman/My Builds/testcase/Makefile$;^C:/hoffman/My Builds/testcase/Makefile\\.in$;^C:/hoffman/My Builds/testcase/.*\\.lo$;^C:/hoffman/My Builds/testcase/.*\\.la$;^C:/hoffman/My Builds/testcase/mkinstalldirs$;^C:/hoffman/My Builds/testcase/missing$;^C:/hoffman/My Builds/testcase/ltmain\\.sh$;^C:/hoffman/My Builds/testcase/libtool$;^C:/hoffman/My Builds/testcase/install-sh$;^C:/hoffman/My Builds/testcase/configure$;^C:/hoffman/My Builds/testcase/config\\.sub$;^C:/hoffman/My Builds/testcase/config\\.status$;^C:/hoffman/My Builds/testcase/config\\.log$;^C:/hoffman/My Builds/testcase/config\\.guess$;^C:/hoffman/My Builds/testcase/autom4te\\.cache$;^C:/hoffman/My Builds/testcase/aclocal\\.m4$;^C:/hoffman/My Builds/testcase/depcomp$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.075\\.model_cassisi_eos1_10$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.075\\.model_cassisi_eos1_10_corr$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.1\\.model_cassisi_eos1$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.1\\.model_cassisi_scvh$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.1\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.3\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/1\\.0\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/1\\.0\\.rgbtip\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/1\\.0\\.zahb\\.modelc$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.1\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/1\\.0\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.3\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/eff_fit/rho-T-loci/0\\.085\\.model$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/.*\\.ps$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.mem$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.log$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.dvi$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/exchange\\.tex\\.bak$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/head\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/body\\.tmp$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/prior-dvi\\.aux$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j10\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j12\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j16\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j20\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j22\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j26\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j30\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j32\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/j36\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k10\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k12\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k20\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k22\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k30\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/k32\\.tex$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/1_exchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/1_exchange_dlnp\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/2_exchange_dgamma1\\.yplot$;^C:/hoffman/My Builds/testcase/www/eospaper/exchange/2_
|
2006-10-19 22:45:41 +04:00
|
|
|
|
2002-08-13 23:47:19 +04:00
|
|
|
#
|
|
|
|
# Define a macro
|
|
|
|
#
|
2012-08-13 21:47:32 +04:00
|
|
|
macro(ASSERT value msg)
|
|
|
|
if (NOT ${value})
|
|
|
|
message ("Assertion failure:" ${msg} )
|
2012-08-13 21:50:14 +04:00
|
|
|
endif ()
|
|
|
|
endmacro()
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2002-08-13 23:47:19 +04:00
|
|
|
# invoke the macro
|
|
|
|
ASSERT(Complex_BINARY_DIR "The PROJECT command is broken")
|
2002-04-18 00:16:06 +04:00
|
|
|
|
2004-04-26 19:12:19 +04:00
|
|
|
#
|
|
|
|
# Define a var args macro, it must take two or four args
|
|
|
|
#
|
2012-08-13 21:47:32 +04:00
|
|
|
macro(TEST_ARGC value1 value2)
|
|
|
|
add_definitions(${value1} ${value2})
|
2014-04-11 20:49:03 +04:00
|
|
|
if (${ARGC} EQUAL 4)
|
2012-08-13 21:47:32 +04:00
|
|
|
add_definitions(${ARGV2} ${ARGV3})
|
2012-08-13 21:50:14 +04:00
|
|
|
endif ()
|
|
|
|
endmacro()
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2004-04-26 19:12:19 +04:00
|
|
|
# invoke the macro
|
|
|
|
TEST_ARGC(-DCMAKE_ARGV1 -DCMAKE_ARGV2 -DCMAKE_ARGV3 -DCMAKE_ARGV4)
|
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
macro(TEST_VAR_ARG fa)
|
2013-06-02 23:42:10 +04:00
|
|
|
if("${ARGV}" STREQUAL "1;2;3")
|
2012-08-13 21:47:32 +04:00
|
|
|
message(STATUS "ARGV works")
|
2012-08-13 21:50:14 +04:00
|
|
|
else()
|
2012-08-13 21:47:32 +04:00
|
|
|
message(FATAL_ERROR "ARGV does not work; got \"${ARGV}\" instead of \"1;2;3\"")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2013-06-02 23:42:10 +04:00
|
|
|
if("${ARGN}" STREQUAL "2;3")
|
2012-08-13 21:47:32 +04:00
|
|
|
message(STATUS "ARGN works")
|
2012-08-13 21:50:14 +04:00
|
|
|
else()
|
2012-08-13 21:47:32 +04:00
|
|
|
message(FATAL_ERROR "ARGV does not work; got \"${ARGN}\" instead of \"2;3\"")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
|
|
|
endmacro()
|
2004-04-30 01:41:33 +04:00
|
|
|
|
|
|
|
TEST_VAR_ARG(1 2 3)
|
|
|
|
|
2006-10-30 18:38:55 +03:00
|
|
|
# Floating-point comparison test.
|
2012-08-13 21:47:32 +04:00
|
|
|
if(2.4 LESS 2.4)
|
|
|
|
message(FATAL_ERROR "Failed: 2.4 LESS 2.4")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
if(2.4 GREATER 2.4)
|
|
|
|
message(FATAL_ERROR "Failed: 2.4 GREATER 2.4")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
if(NOT 2.4 EQUAL 2.4)
|
|
|
|
message(FATAL_ERROR "Failed: NOT 2.4 EQUAL 2.4")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
|
2014-04-11 20:17:46 +04:00
|
|
|
if(CMAKE_SYSTEM MATCHES "OSF1-V")
|
2012-08-13 21:47:32 +04:00
|
|
|
if(NOT CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
|
|
|
|
|
|
|
|
add_definitions(-DCMAKE_IS_FUN)
|
|
|
|
add_definitions(-DCMAKE_IS_REALLY_FUN)
|
|
|
|
set_property(DIRECTORY
|
2008-01-18 04:34:10 +03:00
|
|
|
PROPERTY COMPILE_DEFINITIONS_RELEASE
|
|
|
|
CMAKE_IS_FUN_IN_RELEASE_MODE
|
|
|
|
)
|
2001-08-23 21:57:45 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
set(TEST_SEP "a b c")
|
|
|
|
separate_arguments(TEST_SEP)
|
2002-04-30 22:01:07 +04:00
|
|
|
|
|
|
|
|
2002-01-20 05:24:55 +03:00
|
|
|
#
|
|
|
|
# Include vars from a file and from a cache
|
|
|
|
#
|
2012-08-13 21:47:32 +04:00
|
|
|
if (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake)
|
|
|
|
include(${Complex_SOURCE_DIR}/VarTests.cmake)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif ()
|
2012-08-13 21:47:32 +04:00
|
|
|
include(fileshouldnotbehere OPTIONAL)
|
|
|
|
load_cache(${Complex_SOURCE_DIR}/Cache
|
2002-01-20 08:12:27 +03:00
|
|
|
EXCLUDE
|
|
|
|
CACHE_TEST_VAR_EXCLUDED
|
|
|
|
INCLUDE_INTERNALS
|
|
|
|
CACHE_TEST_VAR_INTERNAL)
|
2002-01-19 03:21:43 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
load_cache(${Complex_SOURCE_DIR}/Cache READ_WITH_PREFIX foo CACHE_TEST_VAR2)
|
|
|
|
if(${fooCACHE_TEST_VAR2} MATCHES bar)
|
|
|
|
message("Load cache worked: ${fooCACHE_TEST_VAR2}")
|
2012-08-13 21:50:14 +04:00
|
|
|
else()
|
2012-08-13 21:47:32 +04:00
|
|
|
message(FATAL_ERROR "Load cache with prefix failed: ${fooCACHE_TEST_VAR2}")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2003-08-08 00:07:23 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
2002-01-20 05:24:55 +03:00
|
|
|
#
|
2012-08-13 21:42:58 +04:00
|
|
|
# Specify include and lib dirs
|
2002-01-20 08:12:27 +03:00
|
|
|
# (BEFORE is for coverage)
|
2002-01-20 05:24:55 +03:00
|
|
|
#
|
2012-08-13 21:47:32 +04:00
|
|
|
include_directories(
|
2006-10-05 20:04:30 +04:00
|
|
|
Library
|
2001-08-23 21:57:45 +04:00
|
|
|
)
|
2002-01-17 23:49:08 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
include_directories(BEFORE
|
2002-01-20 08:12:27 +03:00
|
|
|
${Complex_BINARY_DIR}
|
|
|
|
)
|
2012-08-13 21:47:32 +04:00
|
|
|
include_directories(SYSTEM Library/SystemDir)
|
2002-01-20 08:12:27 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
include_regular_expression("^(cmTest|file|sharedFile|test).*$" "^cmMissing")
|
2002-01-20 05:24:55 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
link_directories(
|
2002-01-17 23:49:08 +03:00
|
|
|
${Complex_BINARY_DIR}/Library
|
2001-08-23 21:57:45 +04:00
|
|
|
)
|
|
|
|
|
2002-10-09 23:54:34 +04:00
|
|
|
#
|
|
|
|
# check for SET CACHE FORCE
|
|
|
|
#
|
2012-08-13 21:47:32 +04:00
|
|
|
set(FORCE_TEST 1 CACHE STRING "a test")
|
|
|
|
set(FORCE_TEST 0 CACHE STRING "a test" FORCE)
|
2002-10-09 23:54:34 +04:00
|
|
|
|
2002-01-20 05:24:55 +03:00
|
|
|
#
|
|
|
|
# Lib and exe path
|
|
|
|
#
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${Complex_BINARY_DIR}/lib/static")
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${Complex_BINARY_DIR}/lib")
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${Complex_BINARY_DIR}/bin")
|
2002-01-17 23:49:08 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
message (Test " " escape " " semi-colon " " \; \;)
|
2002-01-18 20:03:32 +03:00
|
|
|
#
|
2002-01-19 04:32:06 +03:00
|
|
|
# Exec program (TODO: test a result)
|
2002-01-18 20:03:32 +03:00
|
|
|
# Increase coverage.
|
|
|
|
#
|
2012-08-13 21:47:32 +04:00
|
|
|
message("\nIgnore this message")
|
|
|
|
option(NO_EXEC_PROGRAM "Do not test EXEC_PROGRAM" 0)
|
|
|
|
if (NOT NO_EXEC_PROGRAM)
|
|
|
|
exec_program(${CMAKE_COMMAND} ARGS -E echo NO_EXEC_PROGRAM "${Complex_BINARY_DIR}")
|
2012-08-13 21:50:14 +04:00
|
|
|
else ()
|
2012-08-13 21:47:32 +04:00
|
|
|
message("Set this option ON")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif ()
|
2002-01-19 04:32:06 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
mark_as_advanced(NO_EXEC_PROGRAM)
|
|
|
|
mark_as_advanced(CLEAR NO_EXEC_PROGRAM)
|
2002-01-17 23:49:08 +03:00
|
|
|
|
2006-02-04 01:09:35 +03:00
|
|
|
# Execute a process. Add coverage for this command.
|
2012-08-13 21:47:32 +04:00
|
|
|
execute_process(
|
2006-02-04 01:09:35 +03:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E echo "ABCDEFG"
|
|
|
|
OUTPUT_VARIABLE TEST_OUT
|
|
|
|
)
|
2013-06-02 23:42:10 +04:00
|
|
|
if("${TEST_OUT}" STREQUAL "ABCDEFG\n")
|
2012-08-13 21:50:14 +04:00
|
|
|
else()
|
2012-08-13 21:47:32 +04:00
|
|
|
message(SEND_ERROR "EXECUTE_PROCESS output test failed: [${TEST_OUT}]")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2006-05-08 18:02:28 +04:00
|
|
|
|
|
|
|
# This test has some problems on UNIX systems. Disabling for now.
|
|
|
|
#
|
2012-08-13 21:47:32 +04:00
|
|
|
# execute_process(
|
2006-05-08 18:02:28 +04:00
|
|
|
# COMMAND ${CMAKE_COMMAND} -E echo "ABCDEFG"
|
|
|
|
# COMMAND /process/does/not/exist
|
|
|
|
# OUTPUT_QUIET
|
|
|
|
# ERROR_QUIET
|
|
|
|
# RESULT_VARIABLE RESULT
|
|
|
|
# )
|
2013-06-02 23:42:10 +04:00
|
|
|
# if("${RESULT}" STREQUAL "0")
|
2012-08-13 21:47:32 +04:00
|
|
|
# message(SEND_ERROR
|
2006-05-08 18:02:28 +04:00
|
|
|
# "EXECUTE_PROCESS result test failed with RESULT=[${RESULT}]")
|
2012-08-13 21:50:14 +04:00
|
|
|
# else()
|
2012-08-13 21:47:32 +04:00
|
|
|
# message(STATUS "EXECUTE_PROCESS result test passed with RESULT=[${RESULT}]")
|
2012-08-13 21:50:14 +04:00
|
|
|
# endif()
|
2006-02-04 01:09:35 +03:00
|
|
|
|
2002-01-19 03:21:43 +03:00
|
|
|
#
|
|
|
|
# Create directory.
|
|
|
|
# The 'complex' executable will then test if this dir exists,
|
|
|
|
# sadly it won't be able to remove it.
|
|
|
|
#
|
2012-08-13 21:47:32 +04:00
|
|
|
make_directory("${Complex_BINARY_DIR}/make_dir")
|
2002-03-29 23:02:18 +03:00
|
|
|
|
|
|
|
#
|
|
|
|
# Test FIND_LIBARY
|
|
|
|
# Create a dummy empty lib
|
|
|
|
#
|
2012-08-13 21:47:32 +04:00
|
|
|
configure_file(
|
2002-03-29 23:41:10 +03:00
|
|
|
${Complex_SOURCE_DIR}/Library/dummy
|
|
|
|
${Complex_BINARY_DIR}/Library/dummylib.lib
|
2013-11-13 12:50:56 +04:00
|
|
|
COPYONLY)
|
2012-08-13 21:47:32 +04:00
|
|
|
foreach (ext ${CMAKE_SHLIB_SUFFIX};.so;.a;.sl)
|
|
|
|
configure_file(
|
2002-03-29 23:02:18 +03:00
|
|
|
${Complex_SOURCE_DIR}/Library/dummy
|
2002-03-29 23:41:10 +03:00
|
|
|
${Complex_BINARY_DIR}/Library/libdummylib${ext}
|
2013-11-13 12:50:56 +04:00
|
|
|
COPYONLY)
|
2012-08-13 21:50:14 +04:00
|
|
|
endforeach ()
|
2002-03-29 23:02:18 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
find_library(FIND_DUMMY_LIB
|
2002-03-29 23:02:18 +03:00
|
|
|
dummylib
|
|
|
|
PATHS
|
2002-05-23 21:23:35 +04:00
|
|
|
${Complex_BINARY_DIR}/Library DOC "find dummy lib")
|
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
find_library(FIND_DUMMY_LIB
|
2002-05-23 21:23:35 +04:00
|
|
|
NAMES dummylib dummylib2
|
|
|
|
PATHS
|
|
|
|
${Complex_BINARY_DIR}/Library DOC "find dummy lib")
|
2002-03-29 23:02:18 +03:00
|
|
|
|
|
|
|
#
|
2012-08-13 21:42:58 +04:00
|
|
|
# Test SET_SOURCE_FILES_PROPERTIES
|
2002-03-29 23:02:18 +03:00
|
|
|
#
|
2012-08-13 21:47:32 +04:00
|
|
|
set_source_files_properties(nonexisting_file2
|
2012-08-13 21:42:58 +04:00
|
|
|
GENERATED
|
|
|
|
ABSTRACT
|
|
|
|
WRAP_EXCLUDE
|
2004-04-15 21:59:29 +04:00
|
|
|
COMPILE_FLAGS "-foo -bar")
|
2002-03-29 23:02:18 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
get_source_file_property(FILE_HAS_ABSTRACT nonexisting_file2 ABSTRACT)
|
|
|
|
get_source_file_property(FILE_HAS_WRAP_EXCLUDE nonexisting_file2 WRAP_EXCLUDE)
|
|
|
|
get_source_file_property(FILE_COMPILE_FLAGS nonexisting_file2 COMPILE_FLAGS)
|
2002-03-29 23:02:18 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
set_source_files_properties(nonexisting_file3 PROPERTIES
|
2004-04-15 21:59:29 +04:00
|
|
|
GENERATED 1
|
|
|
|
ABSTRACT 1
|
|
|
|
WRAP_EXCLUDE 1
|
|
|
|
COMPILE_FLAGS "-foo -bar")
|
2012-08-13 21:47:32 +04:00
|
|
|
get_source_file_property(FILE_HAS_ABSTRACT nonexisting_file3 ABSTRACT)
|
|
|
|
get_source_file_property(FILE_HAS_WRAP_EXCLUDE nonexisting_file3 WRAP_EXCLUDE)
|
|
|
|
get_source_file_property(FILE_COMPILE_FLAGS nonexisting_file3 COMPILE_FLAGS)
|
2002-08-26 23:20:47 +04:00
|
|
|
|
2002-04-01 23:58:21 +04:00
|
|
|
#
|
|
|
|
# Test registry (win32)
|
|
|
|
# Create a file, put its path in a registry key, try to find the file in that
|
|
|
|
# path using that registry key, then remove the file and the key
|
|
|
|
#
|
2012-08-13 21:47:32 +04:00
|
|
|
if (WIN32)
|
|
|
|
if (NOT UNIX)
|
|
|
|
set(dir "${Complex_BINARY_DIR}/registry_dir")
|
|
|
|
set(file "registry_test_dummy")
|
|
|
|
set(hkey "HKEY_CURRENT_USER\\Software\\Kitware\\CMake\\Tests\\Complex;registry_test")
|
|
|
|
configure_file(
|
2002-04-01 23:58:21 +04:00
|
|
|
${Complex_SOURCE_DIR}/Library/dummy
|
|
|
|
"${dir}/${file}"
|
2013-11-13 12:50:56 +04:00
|
|
|
COPYONLY)
|
2012-08-13 21:47:32 +04:00
|
|
|
exec_program(${CMAKE_COMMAND} ARGS "-E write_regv \"${hkey}\" \"${dir}\"")
|
|
|
|
find_path(REGISTRY_TEST_PATH
|
2004-04-15 21:59:29 +04:00
|
|
|
${file}
|
|
|
|
"[${hkey}]" DOC "Registry_Test_Path")
|
2012-08-13 21:47:32 +04:00
|
|
|
exec_program(${CMAKE_COMMAND} ARGS "-E delete_regv \"${hkey}\"")
|
|
|
|
exec_program(${CMAKE_COMMAND} ARGS "-E remove \"${dir}/${file}\"")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif ()
|
|
|
|
endif ()
|
2002-04-01 23:58:21 +04:00
|
|
|
|
2002-04-22 19:51:26 +04:00
|
|
|
#
|
|
|
|
# Test a set and a remove
|
|
|
|
#
|
2012-08-13 21:47:32 +04:00
|
|
|
set(REMOVE_STRING a b c d e f)
|
|
|
|
set(removeVar1 c e)
|
|
|
|
remove(REMOVE_STRING ${removeVar1} f)
|
2002-04-22 19:51:26 +04:00
|
|
|
|
2002-07-17 01:42:56 +04:00
|
|
|
#
|
|
|
|
# Test an IF inside a FOREACH.
|
|
|
|
#
|
2012-08-13 21:47:32 +04:00
|
|
|
foreach(x "a")
|
|
|
|
if(${x} MATCHES "a")
|
2002-07-17 01:42:56 +04:00
|
|
|
# Should always execute.
|
2012-08-13 21:47:32 +04:00
|
|
|
set(IF_INSIDE_FOREACH_THEN_EXECUTED 1)
|
2012-08-13 21:50:14 +04:00
|
|
|
else()
|
2002-07-17 01:42:56 +04:00
|
|
|
# Should never execute.
|
2012-08-13 21:47:32 +04:00
|
|
|
set(IF_INSIDE_FOREACH_ELSE_EXECUTED 1)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
|
|
|
endforeach()
|
2002-07-17 01:42:56 +04:00
|
|
|
|
2005-06-30 21:39:38 +04:00
|
|
|
# test WHILE command
|
2012-08-13 21:47:32 +04:00
|
|
|
set (while_var 1)
|
|
|
|
while (while_var LESS 1000)
|
|
|
|
set(while_var ${while_var}0)
|
2012-08-13 21:50:14 +04:00
|
|
|
endwhile()
|
2002-07-17 01:42:56 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
set(SHOULD_BE_ZERO )
|
|
|
|
set(SHOULD_BE_ONE 1)
|
2006-09-22 19:49:56 +04:00
|
|
|
|
2012-08-13 21:42:58 +04:00
|
|
|
# test elseif functionality, the mess below tries to catch problem
|
2006-09-22 19:49:56 +04:00
|
|
|
# of clauses being executed early or late etc
|
|
|
|
set (RESULT 3)
|
|
|
|
if (RESULT EQUAL 1)
|
|
|
|
if (RESULT EQUAL 2)
|
|
|
|
set (ELSEIF_RESULT 1)
|
|
|
|
elseif (RESULT EQUAL 3)
|
|
|
|
set (ELSEIF_RESULT 1)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif ()
|
2006-09-22 19:49:56 +04:00
|
|
|
elseif (RESULT EQUAL 2)
|
|
|
|
set (ELSEIF_RESULT 1)
|
|
|
|
elseif (RESULT EQUAL 3)
|
|
|
|
if (RESULT EQUAL 2)
|
|
|
|
set (ELSEIF_RESULT 1)
|
|
|
|
elseif (RESULT EQUAL 3)
|
|
|
|
if (NOT ELSEIF_RESULT EQUAL 1)
|
|
|
|
set (ELSEIF_RESULT 2)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif ()
|
|
|
|
endif ()
|
2006-09-22 19:49:56 +04:00
|
|
|
elseif (RESULT EQUAL 4)
|
|
|
|
if (RESULT EQUAL 2)
|
|
|
|
set (ELSEIF_RESULT 1)
|
|
|
|
elseif (RESULT EQUAL 3)
|
|
|
|
set (ELSEIF_RESULT 1)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif ()
|
|
|
|
else ()
|
2006-09-22 19:49:56 +04:00
|
|
|
if (RESULT EQUAL 2)
|
|
|
|
set (ELSEIF_RESULT 1)
|
|
|
|
elseif (RESULT EQUAL 3)
|
|
|
|
set (ELSEIF_RESULT 1)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif ()
|
|
|
|
endif ()
|
2006-09-22 19:49:56 +04:00
|
|
|
|
|
|
|
if (NOT ELSEIF_RESULT EQUAL 2)
|
|
|
|
set (ELSEIF_RESULT 0)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif ()
|
2006-09-22 19:49:56 +04:00
|
|
|
|
2008-06-26 21:01:35 +04:00
|
|
|
# test handling of parenthetical groups in conditionals
|
|
|
|
if (2 GREATER 1 AND (4 LESS 3 OR 5 LESS 6) AND NOT (7 GREATER 8))
|
|
|
|
set(CONDITIONAL_PARENTHESES 1)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2002-03-29 23:02:18 +03:00
|
|
|
#
|
2012-08-13 21:42:58 +04:00
|
|
|
# Configure file
|
2002-03-29 23:02:18 +03:00
|
|
|
# (plug vars to #define so that they can be tested)
|
|
|
|
#
|
2012-08-13 21:47:32 +04:00
|
|
|
configure_file(
|
2002-03-29 23:02:18 +03:00
|
|
|
${Complex_SOURCE_DIR}/cmTestConfigure.h.in
|
|
|
|
${Complex_BINARY_DIR}/cmTestConfigure.h)
|
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
set(STRING_WITH_QUOTES "\"hello world\"")
|
2002-05-23 21:04:00 +04:00
|
|
|
# test CONFIGURE_FILE with ESCAPE_QUOTES on
|
2012-08-13 21:47:32 +04:00
|
|
|
configure_file(
|
2002-05-23 21:04:00 +04:00
|
|
|
${Complex_SOURCE_DIR}/cmTestConfigureEscape.h.in
|
|
|
|
${Complex_BINARY_DIR}/cmTestConfigureEscape.h ESCAPE_QUOTES)
|
|
|
|
|
2002-11-07 01:35:27 +03:00
|
|
|
# Test regular expression commands.
|
2012-08-13 21:47:32 +04:00
|
|
|
string(REGEX MATCH "b" RESULT "abc")
|
|
|
|
if(NOT RESULT)
|
|
|
|
message(SEND_ERROR "string(REGEX MATCH ... ) test failed.")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
string(REGEX MATCHALL "b" RESULT "abcb")
|
|
|
|
if(NOT RESULT)
|
|
|
|
message(SEND_ERROR "string(REGEX MATCHALL ... ) test failed.")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
string(REGEX REPLACE ".([bd])." "[\\1]" RESULT "a(b)c(d)e")
|
2013-06-02 23:42:10 +04:00
|
|
|
if(NOT RESULT STREQUAL "a[b]c[d]e")
|
2012-08-13 21:47:32 +04:00
|
|
|
message(SEND_ERROR
|
|
|
|
"string(REGEX REPLACE ... ) test failed (\"${RESULT}\" v. \"a[b]c[d]e\")")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2002-11-07 01:35:27 +03:00
|
|
|
|
2014-04-15 20:52:30 +04:00
|
|
|
#
|
|
|
|
# This tests needs Ansi C++98
|
|
|
|
#
|
|
|
|
set(CMAKE_CXX_STANDARD 98)
|
|
|
|
#
|
|
|
|
# GNU extensions are needed for stricmp() on Windows.
|
|
|
|
#
|
|
|
|
set(CMAKE_CXX_EXTENSIONS TRUE)
|
|
|
|
|
|
|
|
# Those versions of the HP compiler that need a flag to get proper C++98
|
|
|
|
# template support also need a flag to use the newer C++ library.
|
|
|
|
if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND
|
|
|
|
CMAKE_CXX98_STANDARD_COMPILE_OPTION STREQUAL "+hpxstd98")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA")
|
|
|
|
endif ()
|
2006-09-22 19:49:56 +04:00
|
|
|
|
2002-03-29 23:02:18 +03:00
|
|
|
#
|
|
|
|
# Create the libs and the main exe
|
|
|
|
#
|
2012-08-13 21:47:32 +04:00
|
|
|
add_subdirectory(Library)
|
|
|
|
add_subdirectory(Executable)
|
|
|
|
subdir_depends(Executable Library)
|
|
|
|
export_library_dependencies(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake)
|
|
|
|
include(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake OPTIONAL)
|