diff options
Diffstat (limited to 'Tests/Complex/VarTests.cmake')
-rw-r--r-- | Tests/Complex/VarTests.cmake | 346 |
1 files changed, 173 insertions, 173 deletions
diff --git a/Tests/Complex/VarTests.cmake b/Tests/Complex/VarTests.cmake index c146d1be0..52ec1fc8e 100644 --- a/Tests/Complex/VarTests.cmake +++ b/Tests/Complex/VarTests.cmake @@ -1,198 +1,198 @@ # # Test SET # -SET (ZERO_VAR 0) -SET (ZERO_VAR2 0) +set (ZERO_VAR 0) +set (ZERO_VAR2 0) -IF(ZERO_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED) -ELSE(ZERO_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED) -ENDIF(ZERO_VAR) +if(ZERO_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED) +else() + add_definitions(-DSHOULD_BE_DEFINED) +endif() -SET(ONE_VAR 1) -SET(ONE_VAR2 1) -SET(STRING_VAR "CMake is great" CACHE STRING "test a cache variable") +set(ONE_VAR 1) +set(ONE_VAR2 1) +set(STRING_VAR "CMake is great" CACHE STRING "test a cache variable") # # Test VARIABLE_REQUIRES # -VARIABLE_REQUIRES(ONE_VAR +variable_requires(ONE_VAR ONE_VAR_IS_DEFINED ONE_VAR) # # Test various IF/ELSE combinations # -IF(NOT ZERO_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_NOT) -ELSE(NOT ZERO_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_NOT) -ENDIF(NOT ZERO_VAR) - -IF(NOT ONE_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_NOT2) -ELSE(NOT ONE_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_NOT2) -ENDIF(NOT ONE_VAR) - -IF(ONE_VAR AND ONE_VAR2) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_AND) -ELSE(ONE_VAR AND ONE_VAR2) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_AND) -ENDIF(ONE_VAR AND ONE_VAR2) - -IF(ONE_VAR AND ZERO_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_AND2) -ELSE(ONE_VAR AND ZERO_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_AND2) -ENDIF(ONE_VAR AND ZERO_VAR) - -IF(ZERO_VAR OR ONE_VAR2) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_OR) -ELSE(ZERO_VAR OR ONE_VAR2) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_OR) -ENDIF(ZERO_VAR OR ONE_VAR2) - -IF(ZERO_VAR OR ZERO_VAR2) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_OR2) -ELSE(ZERO_VAR OR ZERO_VAR2) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_OR2) -ENDIF(ZERO_VAR OR ZERO_VAR2) - -IF(STRING_VAR MATCHES "^CMake") - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_MATCHES) -ELSE(STRING_VAR MATCHES "^CMake") - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES) -ENDIF(STRING_VAR MATCHES "^CMake") - -IF(STRING_VAR MATCHES "^foo") - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_MATCHES2) -ELSE(STRING_VAR MATCHES "^foo") - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_MATCHES2) -ENDIF(STRING_VAR MATCHES "^foo") - -IF(COMMAND "IF") - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND) -ELSE(COMMAND "IF") - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND) -ENDIF(COMMAND "IF") - -IF(COMMAND "ROQUEFORT") - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_COMMAND2) -ELSE(COMMAND "ROQUEFORT") - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_COMMAND2) -ENDIF(COMMAND "ROQUEFORT") - -IF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_EXISTS) -ELSE(EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_EXISTS) -ENDIF (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake) - -IF (EXISTS ${Complex_SOURCE_DIR}/roquefort.txt) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_EXISTS2) -ELSE(EXISTS ${Complex_SOURCE_DIR}/roquefort.txt) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_EXISTS2) -ENDIF (EXISTS ${Complex_SOURCE_DIR}/roquefort.txt) - -IF (IS_DIRECTORY ${Complex_SOURCE_DIR}) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_IS_DIRECTORY) -ENDIF (IS_DIRECTORY ${Complex_SOURCE_DIR}) - -IF (NOT IS_DIRECTORY ${Complex_SOURCE_DIR}/VarTests.cmake) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_IS_DIRECTORY2) -ENDIF (NOT IS_DIRECTORY ${Complex_SOURCE_DIR}/VarTests.cmake) - -SET (SNUM1_VAR "1") -SET (SNUM2_VAR "2") -SET (SNUM3_VAR "1") - - -IF (SNUM1_VAR LESS SNUM2_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_LESS) -ELSE (SNUM1_VAR LESS SNUM2_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_LESS) -ENDIF (SNUM1_VAR LESS SNUM2_VAR) - -IF (SNUM2_VAR LESS SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_LESS2) -ELSE (SNUM2_VAR LESS SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_LESS2) -ENDIF (SNUM2_VAR LESS SNUM1_VAR) - -IF (SNUM2_VAR GREATER SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_GREATER) -ELSE (SNUM2_VAR GREATER SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_GREATER) -ENDIF (SNUM2_VAR GREATER SNUM1_VAR) - -IF (SNUM2_VAR EQUAL SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_EQUAL) -ELSE (SNUM2_VAR EQUAL SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_EQUAL) -ENDIF (SNUM2_VAR EQUAL SNUM1_VAR) - -IF (SNUM3_VAR EQUAL SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_EQUAL) -ELSE (SNUM3_VAR EQUAL SNUM1_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_EQUAL) -ENDIF (SNUM3_VAR EQUAL SNUM1_VAR) - -IF (SNUM1_VAR GREATER SNUM2_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_GREATER2) -ELSE (SNUM1_VAR GREATER SNUM2_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_GREATER2) -ENDIF (SNUM1_VAR GREATER SNUM2_VAR) - -SET (SSTR1_VAR "abc") -SET (SSTR2_VAR "bcd") - -IF (SSTR1_VAR STRLESS SSTR2_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_STRLESS) -ELSE (SSTR1_VAR STRLESS SSTR2_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_STRLESS) -ENDIF (SSTR1_VAR STRLESS SSTR2_VAR) - -IF (SSTR2_VAR STRLESS SSTR1_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_STRLESS2) -ELSE (SSTR2_VAR STRLESS SSTR1_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_STRLESS2) -ENDIF (SSTR2_VAR STRLESS SSTR1_VAR) - -IF (SSTR2_VAR STRGREATER SSTR1_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_STRGREATER) -ELSE (SSTR2_VAR STRGREATER SSTR1_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_STRGREATER) -ENDIF (SSTR2_VAR STRGREATER SSTR1_VAR) - -IF (SSTR1_VAR STRGREATER SSTR2_VAR) - ADD_DEFINITIONS(-DSHOULD_NOT_BE_DEFINED_STRGREATER2) -ELSE (SSTR1_VAR STRGREATER SSTR2_VAR) - ADD_DEFINITIONS(-DSHOULD_BE_DEFINED_STRGREATER2) -ENDIF (SSTR1_VAR STRGREATER SSTR2_VAR) +if(NOT ZERO_VAR) + add_definitions(-DSHOULD_BE_DEFINED_NOT) +else() + add_definitions(-DSHOULD_NOT_BE_DEFINED_NOT) +endif() + +if(NOT ONE_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_NOT2) +else() + add_definitions(-DSHOULD_BE_DEFINED_NOT2) +endif() + +if(ONE_VAR AND ONE_VAR2) + add_definitions(-DSHOULD_BE_DEFINED_AND) +else() + add_definitions(-DSHOULD_NOT_BE_DEFINED_AND) +endif() + +if(ONE_VAR AND ZERO_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_AND2) +else() + add_definitions(-DSHOULD_BE_DEFINED_AND2) +endif() + +if(ZERO_VAR OR ONE_VAR2) + add_definitions(-DSHOULD_BE_DEFINED_OR) +else() + add_definitions(-DSHOULD_NOT_BE_DEFINED_OR) +endif() + +if(ZERO_VAR OR ZERO_VAR2) + add_definitions(-DSHOULD_NOT_BE_DEFINED_OR2) +else() + add_definitions(-DSHOULD_BE_DEFINED_OR2) +endif() + +if(STRING_VAR MATCHES "^CMake") + add_definitions(-DSHOULD_BE_DEFINED_MATCHES) +else() + add_definitions(-DSHOULD_NOT_BE_DEFINED_MATCHES) +endif() + +if(STRING_VAR MATCHES "^foo") + add_definitions(-DSHOULD_NOT_BE_DEFINED_MATCHES2) +else() + add_definitions(-DSHOULD_BE_DEFINED_MATCHES2) +endif() + +if(COMMAND "IF") + add_definitions(-DSHOULD_BE_DEFINED_COMMAND) +else() + add_definitions(-DSHOULD_NOT_BE_DEFINED_COMMAND) +endif() + +if(COMMAND "ROQUEFORT") + add_definitions(-DSHOULD_NOT_BE_DEFINED_COMMAND2) +else() + add_definitions(-DSHOULD_BE_DEFINED_COMMAND2) +endif() + +if (EXISTS ${Complex_SOURCE_DIR}/VarTests.cmake) + add_definitions(-DSHOULD_BE_DEFINED_EXISTS) +else() + add_definitions(-DSHOULD_NOT_BE_DEFINED_EXISTS) +endif () + +if (EXISTS ${Complex_SOURCE_DIR}/roquefort.txt) + add_definitions(-DSHOULD_NOT_BE_DEFINED_EXISTS2) +else() + add_definitions(-DSHOULD_BE_DEFINED_EXISTS2) +endif () + +if (IS_DIRECTORY ${Complex_SOURCE_DIR}) + add_definitions(-DSHOULD_BE_DEFINED_IS_DIRECTORY) +endif () + +if (NOT IS_DIRECTORY ${Complex_SOURCE_DIR}/VarTests.cmake) + add_definitions(-DSHOULD_BE_DEFINED_IS_DIRECTORY2) +endif () + +set (SNUM1_VAR "1") +set (SNUM2_VAR "2") +set (SNUM3_VAR "1") + + +if (SNUM1_VAR LESS SNUM2_VAR) + add_definitions(-DSHOULD_BE_DEFINED_LESS) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_LESS) +endif () + +if (SNUM2_VAR LESS SNUM1_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_LESS2) +else () + add_definitions(-DSHOULD_BE_DEFINED_LESS2) +endif () + +if (SNUM2_VAR GREATER SNUM1_VAR) + add_definitions(-DSHOULD_BE_DEFINED_GREATER) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER) +endif () + +if (SNUM2_VAR EQUAL SNUM1_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_EQUAL) +else () + add_definitions(-DSHOULD_BE_DEFINED_EQUAL) +endif () + +if (SNUM3_VAR EQUAL SNUM1_VAR) + add_definitions(-DSHOULD_BE_DEFINED_EQUAL) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_EQUAL) +endif () + +if (SNUM1_VAR GREATER SNUM2_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER2) +else () + add_definitions(-DSHOULD_BE_DEFINED_GREATER2) +endif () + +set (SSTR1_VAR "abc") +set (SSTR2_VAR "bcd") + +if (SSTR1_VAR STRLESS SSTR2_VAR) + add_definitions(-DSHOULD_BE_DEFINED_STRLESS) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRLESS) +endif () + +if (SSTR2_VAR STRLESS SSTR1_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRLESS2) +else () + add_definitions(-DSHOULD_BE_DEFINED_STRLESS2) +endif () + +if (SSTR2_VAR STRGREATER SSTR1_VAR) + add_definitions(-DSHOULD_BE_DEFINED_STRGREATER) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRGREATER) +endif () + +if (SSTR1_VAR STRGREATER SSTR2_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRGREATER2) +else () + add_definitions(-DSHOULD_BE_DEFINED_STRGREATER2) +endif () # # Test FOREACH # -FOREACH (INDEX 1 2) - SET(FOREACH_VAR${INDEX} "VALUE${INDEX}") -ENDFOREACH(INDEX) +foreach (INDEX 1 2) + set(FOREACH_VAR${INDEX} "VALUE${INDEX}") +endforeach() -SET(FOREACH_CONCAT "") -FOREACH (INDEX a;b;c;d;e;f;g) - SET(FOREACH_CONCAT "${FOREACH_CONCAT}${INDEX}") -ENDFOREACH(INDEX) +set(FOREACH_CONCAT "") +foreach (INDEX a;b;c;d;e;f;g) + set(FOREACH_CONCAT "${FOREACH_CONCAT}${INDEX}") +endforeach() # # Test FIND_FILE, FIND_PATH and various GET_FILENAME_COMPONENT combinations # -FIND_FILE(FILENAME_VAR "VarTests.cmake" ${Complex_SOURCE_DIR}) +find_file(FILENAME_VAR "VarTests.cmake" ${Complex_SOURCE_DIR}) -GET_FILENAME_COMPONENT(FILENAME_VAR_PATH ${FILENAME_VAR} PATH) -GET_FILENAME_COMPONENT(FILENAME_VAR_PATH_NAME ${FILENAME_VAR_PATH} NAME) -GET_FILENAME_COMPONENT(FILENAME_VAR_NAME ${FILENAME_VAR} NAME) -GET_FILENAME_COMPONENT(FILENAME_VAR_EXT ${FILENAME_VAR} EXT) -GET_FILENAME_COMPONENT(FILENAME_VAR_NAME_WE ${FILENAME_VAR} NAME_WE CACHE) +get_filename_component(FILENAME_VAR_PATH ${FILENAME_VAR} PATH) +get_filename_component(FILENAME_VAR_PATH_NAME ${FILENAME_VAR_PATH} NAME) +get_filename_component(FILENAME_VAR_NAME ${FILENAME_VAR} NAME) +get_filename_component(FILENAME_VAR_EXT ${FILENAME_VAR} EXT) +get_filename_component(FILENAME_VAR_NAME_WE ${FILENAME_VAR} NAME_WE CACHE) -FIND_PATH(PATH_VAR "cmTestConfigure.h.in" ${Complex_SOURCE_DIR}) -GET_FILENAME_COMPONENT(PATH_VAR_NAME ${PATH_VAR} NAME) +find_path(PATH_VAR "cmTestConfigure.h.in" ${Complex_SOURCE_DIR}) +get_filename_component(PATH_VAR_NAME ${PATH_VAR} NAME) |