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
|
|
|
#
|
2005-06-08 22:11:25 +04:00
|
|
|
SET(CMAKE_BACKWARDS_COMPATIBILITY 1.4)
|
2001-08-23 21:57:45 +04:00
|
|
|
PROJECT (Complex)
|
|
|
|
|
2006-10-19 22:45:41 +04:00
|
|
|
# Choose whether to test CMakeLib.
|
|
|
|
SET(COMPLEX_TEST_CMAKELIB 1)
|
|
|
|
IF(CMAKE_TEST_DIFFERENT_GENERATOR)
|
|
|
|
SET(COMPLEX_TEST_CMAKELIB 0)
|
|
|
|
ENDIF(CMAKE_TEST_DIFFERENT_GENERATOR)
|
|
|
|
IF(CMAKE_TEST_SYSTEM_LIBRARIES)
|
|
|
|
SET(COMPLEX_TEST_CMAKELIB 0)
|
|
|
|
ENDIF(CMAKE_TEST_SYSTEM_LIBRARIES)
|
2007-07-20 22:08:37 +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
|
|
|
|
#
|
|
|
|
MACRO(ASSERT value msg)
|
|
|
|
IF (NOT ${value})
|
|
|
|
MESSAGE ("Assertion failure:" ${msg} )
|
|
|
|
ENDIF (NOT ${value})
|
|
|
|
ENDMACRO(ASSERT)
|
|
|
|
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
MACRO(TEST_ARGC value1 value2)
|
|
|
|
ADD_DEFINITIONS(${value1} ${value2})
|
|
|
|
IF (${ARGC} MATCHES 4)
|
|
|
|
ADD_DEFINITIONS(${ARGV2} ${ARGV3})
|
|
|
|
ENDIF (${ARGC} MATCHES 4)
|
|
|
|
ENDMACRO(TEST_ARGC)
|
|
|
|
|
|
|
|
# invoke the macro
|
|
|
|
TEST_ARGC(-DCMAKE_ARGV1 -DCMAKE_ARGV2 -DCMAKE_ARGV3 -DCMAKE_ARGV4)
|
|
|
|
|
2004-04-30 01:41:33 +04:00
|
|
|
MACRO(TEST_VAR_ARG fa)
|
|
|
|
IF("${ARGV}" MATCHES "^1;2;3$")
|
|
|
|
MESSAGE(STATUS "ARGV works")
|
|
|
|
ELSE("${ARGV}" MATCHES "^1;2;3$")
|
|
|
|
MESSAGE(FATAL_ERROR "ARGV does not work; got \"${ARGV}\" instead of \"1;2;3\"")
|
|
|
|
ENDIF("${ARGV}" MATCHES "^1;2;3$")
|
|
|
|
IF("${ARGN}" MATCHES "^2;3$")
|
|
|
|
MESSAGE(STATUS "ARGN works")
|
|
|
|
ELSE("${ARGN}" MATCHES "^2;3$")
|
|
|
|
MESSAGE(FATAL_ERROR "ARGV does not work; got \"${ARGN}\" instead of \"2;3\"")
|
|
|
|
ENDIF("${ARGN}" MATCHES "^2;3$")
|
|
|
|
ENDMACRO(TEST_VAR_ARG)
|
|
|
|
|
|
|
|
TEST_VAR_ARG(1 2 3)
|
|
|
|
|
2006-10-30 18:38:55 +03:00
|
|
|
# Floating-point comparison test.
|
|
|
|
IF(2.4 LESS 2.4)
|
|
|
|
MESSAGE(FATAL_ERROR "Failed: 2.4 LESS 2.4")
|
|
|
|
ENDIF(2.4 LESS 2.4)
|
|
|
|
IF(2.4 GREATER 2.4)
|
|
|
|
MESSAGE(FATAL_ERROR "Failed: 2.4 GREATER 2.4")
|
|
|
|
ENDIF(2.4 GREATER 2.4)
|
|
|
|
IF(NOT 2.4 EQUAL 2.4)
|
|
|
|
MESSAGE(FATAL_ERROR "Failed: NOT 2.4 EQUAL 2.4")
|
|
|
|
ENDIF(NOT 2.4 EQUAL 2.4)
|
|
|
|
|
2002-01-17 23:49:08 +03:00
|
|
|
#
|
|
|
|
# Use the ansi CXX compile flag for building cmake
|
|
|
|
#
|
2001-08-29 00:06:52 +04:00
|
|
|
IF (CMAKE_ANSI_CXXFLAGS)
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}")
|
|
|
|
ENDIF (CMAKE_ANSI_CXXFLAGS)
|
2001-08-27 18:11:48 +04:00
|
|
|
|
2002-06-18 16:54:07 +04:00
|
|
|
IF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
|
|
|
|
IF(NOT CMAKE_COMPILER_IS_GNUCXX)
|
2002-06-19 15:28:30 +04:00
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ")
|
2002-06-18 16:54:07 +04:00
|
|
|
ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
|
|
|
|
|
|
|
|
|
2001-08-23 21:57:45 +04:00
|
|
|
ADD_DEFINITIONS(-DCMAKE_IS_FUN)
|
2004-04-15 21:59:29 +04:00
|
|
|
ADD_DEFINITIONS(-DCMAKE_IS_REALLY_FUN)
|
2008-01-18 04:34:10 +03:00
|
|
|
SET_PROPERTY(DIRECTORY
|
|
|
|
PROPERTY COMPILE_DEFINITIONS_RELEASE
|
|
|
|
CMAKE_IS_FUN_IN_RELEASE_MODE
|
|
|
|
)
|
2001-08-23 21:57:45 +04:00
|
|
|
|
2002-04-30 22:01:07 +04:00
|
|
|
SET(TEST_SEP "a b c")
|
|
|
|
SEPARATE_ARGUMENTS(TEST_SEP)
|
|
|
|
|
|
|
|
|
2002-01-20 05:24:55 +03:00
|
|
|
#
|
|
|
|
# Include vars from a file and from a cache
|
|
|
|
#
|
2002-01-19 04:32:06 +03:00
|
|
|
IF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake)
|
|
|
|
INCLUDE(${Complex_SOURCE_DIR}/VarTests.cmake)
|
|
|
|
ENDIF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake)
|
2002-05-23 21:27:21 +04:00
|
|
|
INCLUDE(fileshouldnotbehere OPTIONAL)
|
2002-01-22 23:50:52 +03:00
|
|
|
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
|
|
|
|
2003-08-08 00:54:45 +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}")
|
|
|
|
ELSE(${fooCACHE_TEST_VAR2} MATCHES bar)
|
|
|
|
MESSAGE(FATAL_ERROR "Load cache with prefix failed: ${fooCACHE_TEST_VAR2}")
|
|
|
|
ENDIF(${fooCACHE_TEST_VAR2} MATCHES bar)
|
2003-08-08 00:07:23 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
2002-01-20 05:24:55 +03: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
|
|
|
#
|
2001-08-23 21:57:45 +04:00
|
|
|
INCLUDE_DIRECTORIES(
|
2006-10-05 20:04:30 +04:00
|
|
|
Library
|
2002-01-17 23:49:08 +03:00
|
|
|
${Complex_SOURCE_DIR}/../../Source
|
2003-03-26 18:45:23 +03:00
|
|
|
${Complex_BINARY_DIR}/../../Source
|
2001-08-23 21:57:45 +04:00
|
|
|
)
|
2002-01-17 23:49:08 +03:00
|
|
|
|
2002-01-20 08:12:27 +03:00
|
|
|
INCLUDE_DIRECTORIES(BEFORE
|
|
|
|
${Complex_BINARY_DIR}
|
|
|
|
)
|
2006-10-05 20:04:30 +04:00
|
|
|
INCLUDE_DIRECTORIES(SYSTEM Library/SystemDir)
|
2002-01-20 08:12:27 +03:00
|
|
|
|
2006-10-05 16:55:59 +04:00
|
|
|
INCLUDE_REGULAR_EXPRESSION("^(cmTest|file|sharedFile|test).*$" "^cmMissing")
|
2002-01-20 05:24:55 +03:00
|
|
|
|
2001-08-23 21:57:45 +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
|
|
|
|
#
|
|
|
|
SET(FORCE_TEST 1 CACHE STRING "a test")
|
|
|
|
SET(FORCE_TEST 0 CACHE STRING "a test" FORCE)
|
|
|
|
|
2002-01-20 05:24:55 +03:00
|
|
|
#
|
|
|
|
# Lib and exe path
|
|
|
|
#
|
2007-03-12 17:23:06 +03: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
|
|
|
|
2002-04-18 20:02:00 +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.
|
|
|
|
#
|
2002-03-29 23:02:18 +03:00
|
|
|
MESSAGE("\nIgnore this message")
|
2002-01-19 04:32:06 +03:00
|
|
|
OPTION(NO_EXEC_PROGRAM "Do not test EXEC_PROGRAM" 0)
|
|
|
|
IF (NOT NO_EXEC_PROGRAM)
|
2002-09-28 01:16:03 +04:00
|
|
|
EXEC_PROGRAM(${CMAKE_COMMAND} ARGS -E echo NO_EXEC_PROGRAM "${Complex_BINARY_DIR}")
|
2002-01-19 04:32:06 +03:00
|
|
|
ELSE (NOT NO_EXEC_PROGRAM)
|
|
|
|
MESSAGE("Set this option ON")
|
|
|
|
ENDIF (NOT NO_EXEC_PROGRAM)
|
|
|
|
|
|
|
|
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.
|
|
|
|
EXECUTE_PROCESS(
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E echo "ABCDEFG"
|
|
|
|
OUTPUT_VARIABLE TEST_OUT
|
|
|
|
)
|
2006-02-10 19:47:18 +03:00
|
|
|
IF("${TEST_OUT}" MATCHES "^ABCDEFG\n$")
|
|
|
|
ELSE("${TEST_OUT}" MATCHES "^ABCDEFG\n$")
|
|
|
|
MESSAGE(SEND_ERROR "EXECUTE_PROCESS output test failed: [${TEST_OUT}]")
|
|
|
|
ENDIF("${TEST_OUT}" MATCHES "^ABCDEFG\n$")
|
2006-05-08 18:02:28 +04:00
|
|
|
|
|
|
|
# This test has some problems on UNIX systems. Disabling for now.
|
|
|
|
#
|
|
|
|
# EXECUTE_PROCESS(
|
|
|
|
# COMMAND ${CMAKE_COMMAND} -E echo "ABCDEFG"
|
|
|
|
# COMMAND /process/does/not/exist
|
|
|
|
# OUTPUT_QUIET
|
|
|
|
# ERROR_QUIET
|
|
|
|
# RESULT_VARIABLE RESULT
|
|
|
|
# )
|
|
|
|
# IF("${RESULT}" MATCHES "^0$")
|
|
|
|
# MESSAGE(SEND_ERROR
|
|
|
|
# "EXECUTE_PROCESS result test failed with RESULT=[${RESULT}]")
|
|
|
|
# ELSE("${RESULT}" MATCHES "^0$")
|
|
|
|
# MESSAGE(STATUS "EXECUTE_PROCESS result test passed with RESULT=[${RESULT}]")
|
|
|
|
# ENDIF("${RESULT}" MATCHES "^0$")
|
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.
|
|
|
|
#
|
|
|
|
MAKE_DIRECTORY("${Complex_BINARY_DIR}/make_dir")
|
2002-03-29 23:02:18 +03:00
|
|
|
|
|
|
|
#
|
|
|
|
# Test FIND_LIBARY
|
|
|
|
# Create a dummy empty lib
|
|
|
|
#
|
2002-03-29 23:41:10 +03:00
|
|
|
CONFIGURE_FILE(
|
|
|
|
${Complex_SOURCE_DIR}/Library/dummy
|
|
|
|
${Complex_BINARY_DIR}/Library/dummylib.lib
|
|
|
|
COPYONLY IMMEDIATE)
|
2002-12-12 18:10:34 +03:00
|
|
|
FOREACH (ext ${CMAKE_SHLIB_SUFFIX};.so;.a;.sl)
|
2002-03-29 23:02:18 +03:00
|
|
|
CONFIGURE_FILE(
|
|
|
|
${Complex_SOURCE_DIR}/Library/dummy
|
2002-03-29 23:41:10 +03:00
|
|
|
${Complex_BINARY_DIR}/Library/libdummylib${ext}
|
2002-03-29 23:02:18 +03:00
|
|
|
COPYONLY IMMEDIATE)
|
|
|
|
ENDFOREACH (ext)
|
|
|
|
|
|
|
|
FIND_LIBRARY(FIND_DUMMY_LIB
|
|
|
|
dummylib
|
|
|
|
PATHS
|
2002-05-23 21:23:35 +04:00
|
|
|
${Complex_BINARY_DIR}/Library DOC "find dummy lib")
|
|
|
|
|
|
|
|
FIND_LIBRARY(FIND_DUMMY_LIB
|
|
|
|
NAMES dummylib dummylib2
|
|
|
|
PATHS
|
|
|
|
${Complex_BINARY_DIR}/Library DOC "find dummy lib")
|
2002-03-29 23:02:18 +03:00
|
|
|
|
|
|
|
#
|
|
|
|
# Test SET_SOURCE_FILES_PROPERTIES
|
|
|
|
#
|
|
|
|
SET_SOURCE_FILES_PROPERTIES(nonexisting_file2
|
2004-04-15 21:59:29 +04:00
|
|
|
GENERATED
|
|
|
|
ABSTRACT
|
|
|
|
WRAP_EXCLUDE
|
|
|
|
COMPILE_FLAGS "-foo -bar")
|
2002-03-29 23:02:18 +03: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-08-26 23:20:47 +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")
|
2002-08-26 23:20:47 +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-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
|
|
|
|
#
|
|
|
|
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(
|
|
|
|
${Complex_SOURCE_DIR}/Library/dummy
|
|
|
|
"${dir}/${file}"
|
|
|
|
COPYONLY IMMEDIATE)
|
2002-06-03 21:08:52 +04:00
|
|
|
EXEC_PROGRAM(${CMAKE_COMMAND} ARGS "-E write_regv \"${hkey}\" \"${dir}\"")
|
2002-04-01 23:58:21 +04:00
|
|
|
FIND_PATH(REGISTRY_TEST_PATH
|
2004-04-15 21:59:29 +04:00
|
|
|
${file}
|
|
|
|
"[${hkey}]" DOC "Registry_Test_Path")
|
2002-06-03 21:08:52 +04:00
|
|
|
EXEC_PROGRAM(${CMAKE_COMMAND} ARGS "-E delete_regv \"${hkey}\"")
|
|
|
|
EXEC_PROGRAM(${CMAKE_COMMAND} ARGS "-E remove \"${dir}/${file}\"")
|
2002-04-01 23:58:21 +04:00
|
|
|
ENDIF (NOT UNIX)
|
|
|
|
ENDIF (WIN32)
|
|
|
|
|
2002-04-22 19:51:26 +04:00
|
|
|
#
|
|
|
|
# Test a set and a remove
|
|
|
|
#
|
|
|
|
SET(REMOVE_STRING a b c d e f)
|
|
|
|
SET(removeVar1 c e)
|
|
|
|
REMOVE(REMOVE_STRING ${removeVar1} f)
|
|
|
|
|
2002-07-17 01:42:56 +04:00
|
|
|
#
|
|
|
|
# Test an IF inside a FOREACH.
|
|
|
|
#
|
|
|
|
FOREACH(x "a")
|
2002-07-17 18:48:39 +04:00
|
|
|
IF(${x} MATCHES "a")
|
2002-07-17 01:42:56 +04:00
|
|
|
# Should always execute.
|
|
|
|
SET(IF_INSIDE_FOREACH_THEN_EXECUTED 1)
|
2002-07-17 18:48:39 +04:00
|
|
|
ELSE(${x} MATCHES "a")
|
2002-07-17 01:42:56 +04:00
|
|
|
# Should never execute.
|
|
|
|
SET(IF_INSIDE_FOREACH_ELSE_EXECUTED 1)
|
2002-07-17 18:48:39 +04:00
|
|
|
ENDIF(${x} MATCHES "a")
|
2002-07-17 01:42:56 +04:00
|
|
|
ENDFOREACH(x)
|
|
|
|
|
2005-06-30 21:39:38 +04:00
|
|
|
# test WHILE command
|
|
|
|
SET (while_var 1)
|
|
|
|
WHILE (while_var LESS 1000)
|
|
|
|
SET(while_var ${while_var}0)
|
|
|
|
ENDWHILE(while_var LESS 1000)
|
2002-07-17 01:42:56 +04:00
|
|
|
|
2006-01-04 00:40:51 +03:00
|
|
|
SET(SHOULD_BE_ZERO )
|
|
|
|
SET(SHOULD_BE_ONE 1)
|
2006-09-22 19:49:56 +04:00
|
|
|
|
|
|
|
# test elseif functionality, the mess below tries to catch problem
|
|
|
|
# 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)
|
|
|
|
endif (RESULT EQUAL 2)
|
|
|
|
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)
|
|
|
|
endif (NOT ELSEIF_RESULT EQUAL 1)
|
|
|
|
endif (RESULT EQUAL 2)
|
|
|
|
elseif (RESULT EQUAL 4)
|
|
|
|
if (RESULT EQUAL 2)
|
|
|
|
set (ELSEIF_RESULT 1)
|
|
|
|
elseif (RESULT EQUAL 3)
|
|
|
|
set (ELSEIF_RESULT 1)
|
|
|
|
endif (RESULT EQUAL 2)
|
|
|
|
else (RESULT EQUAL 1)
|
|
|
|
if (RESULT EQUAL 2)
|
|
|
|
set (ELSEIF_RESULT 1)
|
|
|
|
elseif (RESULT EQUAL 3)
|
|
|
|
set (ELSEIF_RESULT 1)
|
|
|
|
endif (RESULT EQUAL 2)
|
|
|
|
endif (RESULT EQUAL 1)
|
|
|
|
|
|
|
|
if (NOT ELSEIF_RESULT EQUAL 2)
|
|
|
|
set (ELSEIF_RESULT 0)
|
|
|
|
endif (NOT ELSEIF_RESULT EQUAL 2)
|
|
|
|
|
2002-03-29 23:02:18 +03:00
|
|
|
#
|
|
|
|
# Configure file
|
|
|
|
# (plug vars to #define so that they can be tested)
|
|
|
|
#
|
|
|
|
CONFIGURE_FILE(
|
|
|
|
${Complex_SOURCE_DIR}/cmTestConfigure.h.in
|
|
|
|
${Complex_BINARY_DIR}/cmTestConfigure.h)
|
|
|
|
|
2002-05-23 21:04:00 +04:00
|
|
|
SET(STRING_WITH_QUOTES "\"hello world\"")
|
|
|
|
# test CONFIGURE_FILE with ESCAPE_QUOTES on
|
|
|
|
CONFIGURE_FILE(
|
|
|
|
${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.
|
|
|
|
STRING(REGEX MATCH "b" RESULT "abc")
|
|
|
|
IF(NOT RESULT)
|
|
|
|
MESSAGE(SEND_ERROR "STRING(REGEX MATCH ... ) test failed.")
|
|
|
|
ENDIF(NOT RESULT)
|
|
|
|
STRING(REGEX MATCHALL "b" RESULT "abcb")
|
|
|
|
IF(NOT RESULT)
|
|
|
|
MESSAGE(SEND_ERROR "STRING(REGEX MATCHALL ... ) test failed.")
|
|
|
|
ENDIF(NOT RESULT)
|
2002-11-07 02:05:39 +03:00
|
|
|
STRING(REGEX REPLACE ".([bd])." "[\\1]" RESULT "a(b)c(d)e")
|
|
|
|
IF("x${RESULT}" MATCHES "^xa\\[b\\]c\\[d\\]e$")
|
2002-11-07 01:35:27 +03:00
|
|
|
SET(STRING_REGEX_PASSED 1)
|
2002-11-07 02:05:39 +03:00
|
|
|
ENDIF("x${RESULT}" MATCHES "^xa\\[b\\]c\\[d\\]e$")
|
2002-11-07 01:35:27 +03:00
|
|
|
IF(NOT STRING_REGEX_PASSED)
|
2002-11-07 02:05:39 +03:00
|
|
|
MESSAGE(SEND_ERROR
|
2004-04-15 21:59:29 +04:00
|
|
|
"STRING(REGEX REPLACE ... ) test failed (\"${RESULT}\" v. \"a[b]c[d]e\")")
|
2002-11-07 01:35:27 +03:00
|
|
|
ENDIF(NOT STRING_REGEX_PASSED)
|
|
|
|
|
2006-09-22 19:49:56 +04:00
|
|
|
|
2002-03-29 23:02:18 +03:00
|
|
|
#
|
|
|
|
# Create the libs and the main exe
|
|
|
|
#
|
2005-06-08 20:26:32 +04:00
|
|
|
ADD_SUBDIRECTORY(Library)
|
|
|
|
ADD_SUBDIRECTORY(Executable)
|
2002-03-29 23:02:18 +03:00
|
|
|
SUBDIR_DEPENDS(Executable Library)
|
2003-01-21 00:59:02 +03:00
|
|
|
EXPORT_LIBRARY_DEPENDENCIES(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake)
|
2003-02-03 21:31:31 +03:00
|
|
|
INCLUDE(${Complex_BINARY_DIR}/ComplexLibraryDepends.cmake OPTIONAL)
|