diff options
author | Anas Nashif <anas.nashif@intel.com> | 2013-02-13 18:21:12 -0800 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2013-02-13 18:21:12 -0800 |
commit | ef8aa19c33e83ff019595fd7f8fdc29c35c336a3 (patch) | |
tree | 6501b44707b5c6a88fa5f817adee1a3ffcb0012d /Tests/CMakeTests | |
parent | 035c7fabc3b82cbc9a346c11abe2e9462b4c0379 (diff) | |
download | cmake-ef8aa19c33e83ff019595fd7f8fdc29c35c336a3.tar.gz cmake-ef8aa19c33e83ff019595fd7f8fdc29c35c336a3.tar.bz2 cmake-ef8aa19c33e83ff019595fd7f8fdc29c35c336a3.zip |
Imported Upstream version 2.8.10.2upstream/2.8.10.2
Diffstat (limited to 'Tests/CMakeTests')
-rw-r--r-- | Tests/CMakeTests/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/CMakeTests/FileDownloadTest.cmake.in | 53 | ||||
-rw-r--r-- | Tests/CMakeTests/FindBaseTest.cmake.in | 16 | ||||
-rw-r--r-- | Tests/CMakeTests/GetFilenameComponentRealpathTest.cmake.in | 2 | ||||
-rw-r--r-- | Tests/CMakeTests/GetPrerequisitesTest.cmake.in | 10 | ||||
-rw-r--r-- | Tests/CMakeTests/IncludeTest.cmake.in | 10 | ||||
-rw-r--r-- | Tests/CMakeTests/ListTest.cmake.in | 101 | ||||
-rw-r--r-- | Tests/CMakeTests/StringTestScript.cmake | 12 | ||||
-rw-r--r-- | Tests/CMakeTests/ToolchainTest.cmake.in | 42 | ||||
-rw-r--r-- | Tests/CMakeTests/VariableWatchTest.cmake.in | 14 | ||||
-rw-r--r-- | Tests/CMakeTests/VersionTest.cmake.in | 7 | ||||
-rw-r--r-- | Tests/CMakeTests/WhileTest.cmake.in | 2 |
12 files changed, 177 insertions, 106 deletions
diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index c42c490b0..d34d4a618 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -1,12 +1,12 @@ -SET(CMAKE_EXECUTABLE "${CMake_BIN_DIR}/cmake") +set(CMAKE_EXECUTABLE "${CMake_BIN_DIR}/cmake") -MACRO(AddCMakeTest TestName PreArgs) - CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/${TestName}Test.cmake.in" +macro(AddCMakeTest TestName PreArgs) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${TestName}Test.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/${TestName}Test.cmake" @ONLY IMMEDIATE) - ADD_TEST(CMake.${TestName} ${CMAKE_EXECUTABLE} ${PreArgs} + add_test(CMake.${TestName} ${CMAKE_EXECUTABLE} ${PreArgs} -P "${CMAKE_CURRENT_BINARY_DIR}/${TestName}Test.cmake" ${ARGN}) -ENDMACRO(AddCMakeTest) +endmacro() AddCMakeTest(List "") @@ -43,12 +43,12 @@ if(HAVE_ELF_H) AddCMakeTest(ELF "") endif() -SET(EndStuff_PreArgs +set(EndStuff_PreArgs "-Ddir:STRING=${CMAKE_CURRENT_BINARY_DIR}/EndStuffTest" ) AddCMakeTest(EndStuff "${EndStuff_PreArgs}") -SET(GetPrerequisites_PreArgs +set(GetPrerequisites_PreArgs "-DCTEST_CONFIGURATION_TYPE:STRING=\\\${CTEST_CONFIGURATION_TYPE}" ) AddCMakeTest(GetPrerequisites "${GetPrerequisites_PreArgs}") diff --git a/Tests/CMakeTests/FileDownloadTest.cmake.in b/Tests/CMakeTests/FileDownloadTest.cmake.in index 9dc2ebb27..91086c6d7 100644 --- a/Tests/CMakeTests/FileDownloadTest.cmake.in +++ b/Tests/CMakeTests/FileDownloadTest.cmake.in @@ -38,6 +38,59 @@ file(DOWNLOAD ${dir}/file3.png TIMEOUT 2 STATUS status + EXPECTED_HASH SHA1=50c614fc28b39c1281d0517bb6d5858b4359c9b7 + ) + +message(STATUS "FileDownload:5") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH SHA224=73cd5f442b04e8320e4f907f8e1b21d4befff98b5bd77bc32526ea68 + ) + +message(STATUS "FileDownload:6") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH SHA256=2e067f6c09cbc7cd619c8fbcc44eb64cd6b45a95e4cddb3a585eee1f731c4da9 + ) + +message(STATUS "FileDownload:7") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH SHA384=398bf41902a7251c30e522b307e3e41e3fb617c765b3feaa99b2f7d063894708ad399267ccc25d877437a10e5e890d35 + ) + +message(STATUS "FileDownload:8") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH SHA512=c51854d21052713968b849c2b4263cf54be03bc3a7e9847a6c71c6c8d1d13cd805fe1b9fa95f9ba1d0a5631513974f6fae21e34ab5b171d94bad48df5f073e48 + ) +message(STATUS "FileDownload:9") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH MD5=d16778650db435bda3a8c3435c3ff5d1 + ) + +message(STATUS "FileDownload:10") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status EXPECTED_MD5 d16778650db435bda3a8c3435c3ff5d1 ) message(STATUS "${status}") diff --git a/Tests/CMakeTests/FindBaseTest.cmake.in b/Tests/CMakeTests/FindBaseTest.cmake.in index 47c1692db..658b35022 100644 --- a/Tests/CMakeTests/FindBaseTest.cmake.in +++ b/Tests/CMakeTests/FindBaseTest.cmake.in @@ -12,7 +12,7 @@ set(_HEADER_FULL_A "${MY_SOURCE_DIR}/A/include/${_HEADER}") find_file(FOO_H_1 ${_HEADER}) if(FOO_H_1) message(FATAL_ERROR "${_HEADER} found: ${FOO_H_1}, it should not exist !") -endif(FOO_H_1) +endif() # The HINTS option should override the system but the PATHS option # should not. @@ -21,10 +21,10 @@ find_file(TEST_H_1 ${_HEADER} HINTS ${MY_SOURCE_DIR}/A/include) find_file(TEST_H_2 ${_HEADER} PATHS ${MY_SOURCE_DIR}/A/include) if(NOT "${TEST_H_1}" STREQUAL "${_HEADER_FULL_A}") message(FATAL_ERROR "Did not find \"${_HEADER_FULL_A}\"\ngot \"${TEST_H_1}\" instead!") -endif(NOT "${TEST_H_1}" STREQUAL "${_HEADER_FULL_A}") +endif() if(NOT "${TEST_H_2}" STREQUAL "${_HEADER_FULL}") message(FATAL_ERROR "Did not find \"${_HEADER_FULL}\"\ngot \"${TEST_H_2}\" instead!") -endif(NOT "${TEST_H_2}" STREQUAL "${_HEADER_FULL}") +endif() set(CMAKE_SYSTEM_PREFIX_PATH) # with this it still should not be found, since the include/ subdir is still missing @@ -32,20 +32,20 @@ set(CMAKE_INCLUDE_PATH "${MY_SOURCE_DIR}") find_file(FOO_H_2 ${_HEADER}) if(FOO_H_2) message(FATAL_ERROR "${_HEADER} found: ${FOO_H_2}, it should not exist !") -endif(FOO_H_2) +endif() # now with the PATH_SUFFIX it should be found find_file(FOO_H_3 NAMES ${_HEADER} PATH_SUFFIXES include ) if(NOT "${FOO_H_3}" STREQUAL "${_HEADER_FULL}") message(FATAL_ERROR "Did not find \"${_HEADER_FULL}\"\ngot ${FOO_H_3} instead !") -endif(NOT "${FOO_H_3}" STREQUAL "${_HEADER_FULL}") +endif() # without PATH_SUFFIX, but with a CMAKE_INCLUDE_PATH it should not be found set(CMAKE_INCLUDE_PATH /include) find_file(FOO_H_4 ${_HEADER}) if(FOO_H_4) message(FATAL_ERROR "${_HEADER} found: ${FOO_H_4}, it should not exist !") -endif(FOO_H_4) +endif() # when setting CMAKE_FIND_ROOT_PATH to the current source dir, # together with the CMAKE_INCLUDE_PATH it should be found @@ -53,10 +53,10 @@ set(CMAKE_FIND_ROOT_PATH blub "${MY_SOURCE_DIR}") find_file(FOO_H_5 ${_HEADER}) if(NOT "${FOO_H_5}" STREQUAL "${_HEADER_FULL}") message(FATAL_ERROR "Did not find \"${_HEADER_FULL}\"\ngot ${FOO_H_5} instead !") -endif(NOT "${FOO_H_5}" STREQUAL "${_HEADER_FULL}") +endif() # by explicitly disabling CMAKE_FIND_ROOT_PATH again it shouldn't be found find_file(FOO_H_6 ${_HEADER} NO_CMAKE_FIND_ROOT_PATH) if(FOO_H_6) message(FATAL_ERROR "${_HEADER} found: ${FOO_H_6}, it should not exist !") -endif(FOO_H_6) +endif() diff --git a/Tests/CMakeTests/GetFilenameComponentRealpathTest.cmake.in b/Tests/CMakeTests/GetFilenameComponentRealpathTest.cmake.in index 7adc240f0..22f6afd3b 100644 --- a/Tests/CMakeTests/GetFilenameComponentRealpathTest.cmake.in +++ b/Tests/CMakeTests/GetFilenameComponentRealpathTest.cmake.in @@ -66,7 +66,7 @@ if(UNIX) if(EXISTS file1 OR EXISTS file2) message(FATAL_ERROR "removal of file1 or file2 failed") endif() - endif(LN) + endif() file(REMOVE ${bindir}/file3) endif() diff --git a/Tests/CMakeTests/GetPrerequisitesTest.cmake.in b/Tests/CMakeTests/GetPrerequisitesTest.cmake.in index daf467bcc..89ca735d3 100644 --- a/Tests/CMakeTests/GetPrerequisitesTest.cmake.in +++ b/Tests/CMakeTests/GetPrerequisitesTest.cmake.in @@ -58,7 +58,7 @@ function(stresstest_list_prerequisites file) message(STATUS "=============================================================================") message(STATUS "") -endfunction(stresstest_list_prerequisites) +endfunction() function(test_cmake_executables) @@ -68,7 +68,7 @@ function(test_cmake_executables) get_filename_component(cmake_bin_dir "${CMAKE_COMMAND}" PATH) list_prerequisites_by_glob(GLOB "${cmake_bin_dir}/*" 0 0 1) -endfunction(test_cmake_executables) +endfunction() message(STATUS "=============================================================================") @@ -93,7 +93,7 @@ if(do_testdefaults) message(STATUS "") list_prerequisites("${CMAKE_COMMAND}") message(STATUS "") -endif(do_testdefaults) +endif() set(do_stresstest 0) @@ -103,7 +103,7 @@ if(do_stresstest) message(STATUS "") stresstest_list_prerequisites("${CMAKE_COMMAND}") message(STATUS "") -endif(do_stresstest) +endif() test_cmake_executables() @@ -141,7 +141,7 @@ message(STATUS "") get_cmake_property(vs VARIABLES) foreach(v ${vs}) message(STATUS "${v}='${${v}}'") -endforeach(v) +endforeach() message(STATUS "") message(STATUS "=============================================================================") diff --git a/Tests/CMakeTests/IncludeTest.cmake.in b/Tests/CMakeTests/IncludeTest.cmake.in index eca679b4a..985333c4b 100644 --- a/Tests/CMakeTests/IncludeTest.cmake.in +++ b/Tests/CMakeTests/IncludeTest.cmake.in @@ -9,18 +9,18 @@ set(fileTwo "${CMAKE_ROOT}/Modules/CMake.cmake") if(WIN32) string(TOLOWER "${fileOne}" fileOne) string(TOLOWER "${fileTwo}" fileTwo) -endif(WIN32) +endif() if(NOT "${fileOne}" STREQUAL "${fileTwo}") message(FATAL_ERROR "Wrong CMake.cmake was included: \"${fileOne}\" expected \"${fileTwo}\"") -endif(NOT "${fileOne}" STREQUAL "${fileTwo}") +endif() # this one must return NOTFOUND in _includedFile include(I_do_not_exist OPTIONAL RESULT_VARIABLE _includedFile) if(_includedFile) message(FATAL_ERROR "File \"I_do_not_exist\" was included, although it shouldn't exist,\nIncluded file is \"${_includedFile}\"") -endif(_includedFile) +endif() # and this one must succeed too include(CMake OPTIONAL RESULT_VARIABLE _includedFile) @@ -29,11 +29,11 @@ set(fileTwo "${CMAKE_ROOT}/Modules/CMake.cmake") if(WIN32) string(TOLOWER "${fileOne}" fileOne) string(TOLOWER "${fileTwo}" fileTwo) -endif(WIN32) +endif() if(NOT "${fileOne}" STREQUAL "${fileTwo}") message(FATAL_ERROR "Wrong CMake.cmake was included: \"${fileOne}\" expected \"${fileTwo}\"") -endif(NOT "${fileOne}" STREQUAL "${fileTwo}") +endif() # Check that CMAKE_CURRENT_LIST_DIR is working: # Needs to be a file in the build tree, which is correct cmake script diff --git a/Tests/CMakeTests/ListTest.cmake.in b/Tests/CMakeTests/ListTest.cmake.in index cf6f91a70..a16750354 100644 --- a/Tests/CMakeTests/ListTest.cmake.in +++ b/Tests/CMakeTests/ListTest.cmake.in @@ -1,88 +1,99 @@ -MACRO(TEST command expected) - IF("x${result}" STREQUAL "x${expected}") - #MESSAGE("TEST \"${command}\" success: \"${result}\" expected: \"${expected}\"") - ELSE("x${result}" STREQUAL "x${expected}") - MESSAGE(SEND_ERROR "${CMAKE_CURRENT_LIST_LINE}: TEST \"${command}\" failed: \"${result}\" expected: \"${expected}\"") - ENDIF("x${result}" STREQUAL "x${expected}") -ENDMACRO(TEST command expected) +macro(TEST command expected) + if("x${result}" STREQUAL "x${expected}") + #message("TEST \"${command}\" success: \"${result}\" expected: \"${expected}\"") + else() + message(SEND_ERROR "${CMAKE_CURRENT_LIST_LINE}: TEST \"${command}\" failed: \"${result}\" expected: \"${expected}\"") + endif() +endmacro() -SET(mylist andy bill ken brad) +set(mylist andy bill ken brad) -LIST(LENGTH mylist result) +list(LENGTH mylist result) TEST("LENGTH mylist result" "4") -LIST(LENGTH "mylist" result) +list(LENGTH "mylist" result) TEST("LENGTH \"mylist\" result" "4") -LIST(LENGTH "nonexiting_list1" result) +list(LENGTH "nonexiting_list1" result) TEST("LENGTH \"nonexiting_list1\" result" "0") -LIST(GET mylist 3 2 1 0 result) +list(GET mylist 3 2 1 0 result) TEST("GET mylist 3 2 1 0 result" "brad;ken;bill;andy") -LIST(GET mylist 0 item0) -LIST(GET mylist 1 item1) -LIST(GET mylist 2 item2) -LIST(GET mylist 3 item3) -SET(result "${item3}" "${item0}" "${item1}" "${item2}") +list(GET mylist 0 item0) +list(GET mylist 1 item1) +list(GET mylist 2 item2) +list(GET mylist 3 item3) +set(result "${item3}" "${item0}" "${item1}" "${item2}") TEST("GET individual 3 2 1 0 result" "brad;andy;bill;ken") -LIST(GET mylist -1 -2 -3 -4 result) +list(GET mylist -1 -2 -3 -4 result) TEST("GET mylist -1 -2 -3 -4 result" "brad;ken;bill;andy") -LIST(GET mylist -1 2 -3 0 result) +list(GET mylist -1 2 -3 0 result) TEST("GET mylist -1 2 -3 0 ${result}" "brad;ken;bill;andy") -LIST(GET "nonexiting_list2" 1 result) +list(GET "nonexiting_list2" 1 result) TEST("GET \"nonexiting_list2\" 1 result" "NOTFOUND") -SET(result andy) -LIST(APPEND result brad) +set(result andy) +list(APPEND result brad) TEST("APPEND result brad" "andy;brad") -LIST(APPEND "nonexiting_list3" brad) -SET(result "${nonexiting_list3}") +list(APPEND "nonexiting_list3" brad) +set(result "${nonexiting_list3}") TEST("APPEND \"nonexiting_list3\" brad" "brad") -LIST(INSERT "nonexiting_list4" 0 andy bill brad ken) -SET(result "${nonexiting_list4}") +list(INSERT "nonexiting_list4" 0 andy bill brad ken) +set(result "${nonexiting_list4}") TEST("APPEND \"nonexiting_list4\" andy bill brad ken" "andy;bill;brad;ken") -SET(result andy brad) -LIST(INSERT result -1 bill ken) +set(result andy brad) +list(INSERT result -1 bill ken) TEST("INSERT result -1 bill ken" "andy;bill;ken;brad") -SET(result andy bill brad ken bob) -LIST(REMOVE_ITEM result bob) +set(result andy bill brad ken bob) +list(REMOVE_ITEM result bob) TEST("REMOVE_ITEM result bob" "andy;bill;brad;ken") -SET(result andy bill bob brad ken peter) -LIST(REMOVE_ITEM result peter bob) +set(result andy bill bob brad ken peter) +list(REMOVE_ITEM result peter bob) TEST("REMOVE_ITEM result peter bob" "andy;bill;brad;ken") -SET(result bob andy bill bob brad ken bob) -LIST(REMOVE_ITEM result bob) +set(result bob andy bill bob brad ken bob) +list(REMOVE_ITEM result bob) TEST("REMOVE_ITEM result bob" "andy;bill;brad;ken") -SET(result andy bill bob brad ken peter) -LIST(REMOVE_AT result 2 -1) +set(result andy bill bob brad ken peter) +list(REMOVE_AT result 2 -1) TEST("REMOVE_AT result 2 -1" "andy;bill;brad;ken") # ken is at index 2, nobody is not in the list so -1 should be returned -SET(mylist andy bill ken brad) -LIST(FIND mylist ken result) +set(mylist andy bill ken brad) +list(FIND mylist ken result) TEST("FIND mylist ken result" "2") -LIST(FIND mylist nobody result) +list(FIND mylist nobody result) TEST("FIND mylist nobody result" "-1") -SET(result ken bill andy brad) -LIST(SORT result) +set(result ken bill andy brad) +list(SORT result) TEST("SORT result" "andy;bill;brad;ken") -SET(result andy bill brad ken) -LIST(REVERSE result) +set(result andy bill brad ken) +list(REVERSE result) TEST("REVERSE result" "ken;brad;bill;andy") -SET(result bill andy bill brad ken ken ken) -LIST(REMOVE_DUPLICATES result) +set(result bill andy bill brad ken ken ken) +list(REMOVE_DUPLICATES result) TEST("REMOVE_DUPLICATES result" "bill;andy;brad;ken") + +# these commands should just do nothing if the list is already empty +set(result "") +list(REMOVE_DUPLICATES result) +TEST("REMOVE_DUPLICATES empty result" "") + +list(REVERSE result) +TEST("REVERSE empty result" "") + +list(SORT result) +TEST("SORT empty result" "") diff --git a/Tests/CMakeTests/StringTestScript.cmake b/Tests/CMakeTests/StringTestScript.cmake index 7a264a0e2..a562e71d3 100644 --- a/Tests/CMakeTests/StringTestScript.cmake +++ b/Tests/CMakeTests/StringTestScript.cmake @@ -236,42 +236,42 @@ elseif(testname STREQUAL string_find_with_no_possible_result) # pass message(STATUS "v='${v}'") if(NOT(-1 EQUAL ${v})) message(SEND_ERROR "FIND sub-command should return -1 but returned ${v}.") - endif(NOT(-1 EQUAL ${v})) + endif() elseif(testname STREQUAL string_find_reverse_with_no_possible_result) # pass string(FIND "CMake is a great application." "z" v REVERSE) message(STATUS "v='${v}'") if(NOT(-1 EQUAL ${v})) message(SEND_ERROR "FIND REVERSE sub-command should return -1 but returned ${v}.") - endif(NOT(-1 EQUAL ${v})) + endif() elseif(testname STREQUAL string_find_with_required_result) # pass string(FIND "CMake is a great application." "g" v) message(STATUS "v='${v}'") if(NOT(11 EQUAL ${v})) message(SEND_ERROR "FIND sub-command should return 11 but returned ${v}.") - endif(NOT(11 EQUAL ${v})) + endif() elseif(testname STREQUAL string_find_reverse_with_required_result) # pass string(FIND "CMake is a great application." "e" v REVERSE) message(STATUS "v='${v}'") if(NOT(13 EQUAL ${v})) message(SEND_ERROR "FIND REVERSE sub-command should return 13 but returned ${v}.") - endif(NOT(13 EQUAL ${v})) + endif() elseif(testname STREQUAL string_find_word_reverse_with_required_result) # pass string(FIND "The command should find REVERSE in this string. Or maybe this REVERSE?!" "REVERSE" v) message(STATUS "v='${v}'") if(NOT(24 EQUAL ${v})) message(SEND_ERROR "FIND sub-command should return 24 but returned ${v}.") - endif(NOT(24 EQUAL ${v})) + endif() elseif(testname STREQUAL string_find_reverse_word_reverse_with_required_result) # pass string(FIND "The command should find REVERSE in this string. Or maybe this REVERSE?!" "REVERSE" v REVERSE) message(STATUS "v='${v}'") if(NOT(62 EQUAL ${v})) message(SEND_ERROR "FIND sub-command should return 62 but returned ${v}.") - endif(NOT(62 EQUAL ${v})) + endif() else() # fail message(FATAL_ERROR "testname='${testname}' - error: no such test in '${CMAKE_CURRENT_LIST_FILE}'") diff --git a/Tests/CMakeTests/ToolchainTest.cmake.in b/Tests/CMakeTests/ToolchainTest.cmake.in index e4a2e4813..96e7196a5 100644 --- a/Tests/CMakeTests/ToolchainTest.cmake.in +++ b/Tests/CMakeTests/ToolchainTest.cmake.in @@ -1,12 +1,12 @@ ############################################################ # some preparations so that the CMakeDetermineXXX.cmake files will work in scripted mode -# overwrite MARK_AS_ADVANCED(), since this is used in CMakeDetermineCCompiler.cmake +# overwrite mark_as_advanced(), since this is used in CMakeDetermineCCompiler.cmake # which will complain that it can"t be used in script mode macro(MARK_AS_ADVANCED) -endmacro(MARK_AS_ADVANCED) +endmacro() # set this to a place where we are allowed to write -set(CMAKE_PLATFORM_ROOT_BIN "${CMAKE_CURRENT_BINARY_DIR}") +set(CMAKE_PLATFORM_INFO_DIR "${CMAKE_CURRENT_BINARY_DIR}") # don't run the compiler detection set(CMAKE_C_COMPILER_ID_RUN 1) @@ -21,19 +21,19 @@ include(CMakeDetermineSystem) # check that CMAKE_SYSTEM_XXX and CMAKE_HOST_SYSTEM_xxx are identical if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "${CMAKE_HOST_SYSTEM_NAME}") message(FATAL_ERROR "CMAKE_SYSTEM_NAME and CMAKE_HOST_SYSTEM_NAME not identical: \"${CMAKE_SYSTEM_NAME}\" vs. \"${CMAKE_HOST_SYSTEM_NAME}\"") -endif(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "${CMAKE_HOST_SYSTEM_NAME}") +endif() if(NOT "${CMAKE_SYSTEM}" STREQUAL "${CMAKE_HOST_SYSTEM}") message(FATAL_ERROR "CMAKE_SYSTEM and CMAKE_HOST_SYSTEM not identical: \"${CMAKE_SYSTEM}\" vs. \"${CMAKE_HOST_SYSTEM}\"") -endif(NOT "${CMAKE_SYSTEM}" STREQUAL "${CMAKE_HOST_SYSTEM}") +endif() if(NOT "${CMAKE_SYSTEM_VERSION}" STREQUAL "${CMAKE_HOST_SYSTEM_VERSION}") message(FATAL_ERROR "CMAKE_SYSTEM_VERSION and CMAKE_HOST_SYSTEM_VERSION not identical: \"${CMAKE_SYSTEM_VERSION}\" vs. \"${CMAKE_HOST_SYSTEM_VERSION}\"") -endif(NOT "${CMAKE_SYSTEM_VERSION}" STREQUAL "${CMAKE_HOST_SYSTEM_VERSION}") +endif() if(NOT "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "${CMAKE_HOST_SYSTEM_PROCESSOR}") message(FATAL_ERROR "CMAKE_SYSTEM_PROCESSOR and CMAKE_HOST_SYSTEM_PROCESSOR not identical: \"${CMAKE_SYSTEM_PROCESSOR}\" vs. \"${CMAKE_HOST_SYSTEM_PROCESSOR}\"") -endif(NOT "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "${CMAKE_HOST_SYSTEM_PROCESSOR}") +endif() # save the values so we can compare them to CMAKE_HOST_SYSTEM_XXX in the toolchain case @@ -55,7 +55,7 @@ set(CMAKE_HOST_SYSTEM_PROCESSOR) ############################################################ -# now define a toolchain file and check that everything is +# now define a toolchain file and check that everything is # detected correctly and nothing predefined is overwritten set(CMAKE_TOOLCHAIN_FILE "${MY_SOURCE_DIR}/DummyToolchain.cmake") @@ -73,35 +73,35 @@ include(CMakeDetermineCXXCompiler) if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Dumdidum") message(FATAL_ERROR "CMAKE_SYSTEM_NAME overwritten: \"${CMAKE_SYSTEM_NAME}\", was: \"Dumdidum\"") -endif(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Dumdidum") +endif() if(NOT "${CMAKE_SYSTEM}" STREQUAL "Dumdidum-1.0") message(FATAL_ERROR "CMAKE_SYSTEM wrong: \"${CMAKE_SYSTEM}\", expected: \"Dumdidum-1.0\"") -endif(NOT "${CMAKE_SYSTEM}" STREQUAL "Dumdidum-1.0") +endif() set(fileOne "${_INCLUDED_TOOLCHAIN_FILE}") set(fileTwo "${MY_SOURCE_DIR}/DummyToolchain.cmake") if(WIN32) string(TOLOWER "${fileOne}" fileOne) string(TOLOWER "${fileTwo}" fileTwo) -endif(WIN32) +endif() if(NOT "${fileOne}" STREQUAL "${fileTwo}") message(FATAL_ERROR "Wrong toolchain was loaded: \"${fileOne}\" expected \"${fileTwo}\"") -endif(NOT "${fileOne}" STREQUAL "${fileTwo}") +endif() # check that CMAKE_HOST_SYSTEM_XXX and _SYSTEM_xxx detected above are identical if(NOT "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "${NATIVE_SYSTEM_NAME}") message(FATAL_ERROR "CMAKE_HOST_SYSTEM_NAME and NATIVE_SYSTEM_NAME not identical: \"${CMAKE_HOST_SYSTEM_NAME}\" vs. \"${NATIVE_SYSTEM_NAME}\"") -endif(NOT "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "${NATIVE_SYSTEM_NAME}") +endif() if(NOT "${CMAKE_HOST_SYSTEM}" STREQUAL "${NATIVE_SYSTEM}") message(FATAL_ERROR "CMAKE_HOST_SYSTEM and NATIVE_SYSTEM not identical: \"${CMAKE_HOST_SYSTEM}\" vs. \"${NATIVE_SYSTEM}\"") -endif(NOT "${CMAKE_HOST_SYSTEM}" STREQUAL "${NATIVE_SYSTEM}") +endif() if(NOT "${CMAKE_HOST_SYSTEM_VERSION}" STREQUAL "${NATIVE_SYSTEM_VERSION}") message(FATAL_ERROR "CMAKE_HOST_SYSTEM_VERSION and NATIVE_SYSTEM_VERSION not identical: \"${CMAKE_HOST_SYSTEM_VERSION}\" vs. \"${NATIVE_SYSTEM_VERSION}\"") -endif(NOT "${CMAKE_HOST_SYSTEM_VERSION}" STREQUAL "${NATIVE_SYSTEM_VERSION}") +endif() if(NOT "${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "${NATIVE_SYSTEM_PROCESSOR}") message(FATAL_ERROR "CMAKE_HOST_SYSTEM_PROCESSOR and NATIVE_SYSTEM_PROCESSOR not identical: \"${CMAKE_HOST_SYSTEM_PROCESSOR}\" vs. \"${NATIVE_SYSTEM_PROCESSOR}\"") -endif(NOT "${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "${NATIVE_SYSTEM_PROCESSOR}") +endif() ############################################################# @@ -109,15 +109,15 @@ endif(NOT "${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "${NATIVE_SYSTEM_PROCESSOR}" if(NOT "${_CMAKE_TOOLCHAIN_PREFIX}" STREQUAL "arm-elf-") message(FATAL_ERROR "wrong toolchain prefix detected: \"${_CMAKE_TOOLCHAIN_PREFIX}\", expected: \"arm-elf-\"") -endif(NOT "${_CMAKE_TOOLCHAIN_PREFIX}" STREQUAL "arm-elf-") +endif() if(NOT "${_CMAKE_USER_C_COMPILER_PATH}" STREQUAL "/opt/foo/bin") message(FATAL_ERROR "wrong C compiler location detected: \"${_CMAKE_USER_C_COMPILER_PATH}\", expected: \"/opt/foo/bin\"") -endif(NOT "${_CMAKE_USER_C_COMPILER_PATH}" STREQUAL "/opt/foo/bin") +endif() if(NOT "${CMAKE_C_OUTPUT_EXTENSION}" STREQUAL ".foo") message(FATAL_ERROR "C output extension overwritten: \"${CMAKE_C_OUTPUT_EXTENSION}\", was: \".foo\"") -endif(NOT "${CMAKE_C_OUTPUT_EXTENSION}" STREQUAL ".foo") +endif() ############################################################# @@ -125,11 +125,11 @@ endif(NOT "${CMAKE_C_OUTPUT_EXTENSION}" STREQUAL ".foo") if(NOT "${_CMAKE_USER_CXX_COMPILER_PATH}" STREQUAL "/opt/bar/bin") message(FATAL_ERROR "wrong CXX compiler location detected: \"${_CMAKE_USER_CXX_COMPILER_PATH}\", expected: \"/opt/bar/bin\"") -endif(NOT "${_CMAKE_USER_CXX_COMPILER_PATH}" STREQUAL "/opt/bar/bin") +endif() if(NOT "${CMAKE_CXX_OUTPUT_EXTENSION}" STREQUAL ".bar") message(FATAL_ERROR "C output extension overwritten: \"${CMAKE_CXX_OUTPUT_EXTENSION}\", was: \".bar\"") -endif(NOT "${CMAKE_CXX_OUTPUT_EXTENSION}" STREQUAL ".bar") +endif() message(STATUS "CMAKE_SYSTEM: \"${CMAKE_SYSTEM}\"") message(STATUS "_CMAKE_TOOLCHAIN_PREFIX: \"${_CMAKE_TOOLCHAIN_PREFIX}\"") diff --git a/Tests/CMakeTests/VariableWatchTest.cmake.in b/Tests/CMakeTests/VariableWatchTest.cmake.in index bdb4f7ec4..0c084fde8 100644 --- a/Tests/CMakeTests/VariableWatchTest.cmake.in +++ b/Tests/CMakeTests/VariableWatchTest.cmake.in @@ -1,15 +1,15 @@ -MESSAGE("Start") +message("Start") -VARIABLE_WATCH(TESTVAR MESSAGE) -VARIABLE_WATCH(TESTVAR1) +variable_watch(TESTVAR MESSAGE) +variable_watch(TESTVAR1) macro(testwatch var access file stack) - MESSAGE("There was a ${access} access done on the variable: ${var} in file ${file}") - MESSAGE("List file stack is: ${stack}") + message("There was a ${access} access done on the variable: ${var} in file ${file}") + message("List file stack is: ${stack}") set(${var}_watched 1) -endmacro(testwatch) +endmacro() -VARIABLE_WATCH(somevar testwatch) +variable_watch(somevar testwatch) set(TESTVAR1 "1") set(TESTVAR "1") diff --git a/Tests/CMakeTests/VersionTest.cmake.in b/Tests/CMakeTests/VersionTest.cmake.in index 215bb2b96..9e31cb431 100644 --- a/Tests/CMakeTests/VersionTest.cmake.in +++ b/Tests/CMakeTests/VersionTest.cmake.in @@ -7,3 +7,10 @@ if("${CMAKE_VERSION}" VERSION_LESS "${min_ver}") else() message("CMAKE_VERSION=[${CMAKE_VERSION}] is not less than [${min_ver}]") endif() + +set(v 1.2.3.4.5.6.7) +if("${v}.8" VERSION_LESS "${v}.9") + message(STATUS "${v}.8 is less than ${v}.9") +else() + message(FATAL_ERROR "${v}.8 is not less than ${v}.9?") +endif() diff --git a/Tests/CMakeTests/WhileTest.cmake.in b/Tests/CMakeTests/WhileTest.cmake.in index 4693f2d8f..4cec291a0 100644 --- a/Tests/CMakeTests/WhileTest.cmake.in +++ b/Tests/CMakeTests/WhileTest.cmake.in @@ -10,7 +10,7 @@ while(COUNT LESS 200) set(NUMBERS "${NUMBERS} ${NCOUNT}") set(NCOUNT "${NCOUNT}0") endwhile() -endwhile(COUNT LESS 200) +endwhile() if(NOT NUMBERS STREQUAL " 0 3 30 20 3 30") message(SEND_ERROR "while loop nesting error, result: '${NUMBERS}'") |