diff options
author | Brad King <brad.king@kitware.com> | 2022-09-12 13:40:29 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-09-12 13:40:39 (GMT) |
commit | 6183332c27638a0990f0ee7fe6a088e0cadeca19 (patch) | |
tree | 9a4679a432098ef51d845f9e97790e3ed582c3cc /Tests | |
parent | bca403357ed38153cc2aa7764b68d8349ce0333f (diff) | |
parent | 0c141b0393de6fccbef5ab54e93c70720345ed92 (diff) | |
download | CMake-6183332c27638a0990f0ee7fe6a088e0cadeca19.zip CMake-6183332c27638a0990f0ee7fe6a088e0cadeca19.tar.gz CMake-6183332c27638a0990f0ee7fe6a088e0cadeca19.tar.bz2 |
Merge topic 'try_compile_correctly_compute_exec_name'
0c141b0393 try_compile: Record output location instead of reverse computing it
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7626
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/Configure/CopyFileABI-override.cmake (renamed from Tests/RunCMake/Configure/FailCopyFileABI-override.cmake) | 3 | ||||
-rw-r--r-- | Tests/RunCMake/Configure/CopyFileABI-stdout.txt (renamed from Tests/RunCMake/Configure/FailCopyFileABI-stdout.txt) | 2 | ||||
-rw-r--r-- | Tests/RunCMake/Configure/CopyFileABI.cmake (renamed from Tests/RunCMake/Configure/FailCopyFileABI.cmake) | 2 | ||||
-rw-r--r-- | Tests/RunCMake/Configure/FailCopyFileABI-check.cmake | 14 | ||||
-rw-r--r-- | Tests/RunCMake/Configure/RunCMakeTest.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/BuildType.cmake | 6 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/BuildTypeAsFlag.cmake | 7 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/OutputDirAsFlag.cmake | 7 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake | 3 |
9 files changed, 28 insertions, 18 deletions
diff --git a/Tests/RunCMake/Configure/FailCopyFileABI-override.cmake b/Tests/RunCMake/Configure/CopyFileABI-override.cmake index c633555..67f6ed5 100644 --- a/Tests/RunCMake/Configure/FailCopyFileABI-override.cmake +++ b/Tests/RunCMake/Configure/CopyFileABI-override.cmake @@ -1,5 +1,6 @@ # Change the executable suffix that try_compile will use for -# COPY_FILE but not inside the test project. This forces failure. +# COPY_FILE but not inside the test project, to verify +# we can handle envs that try and break everything get_property(in_try_compile GLOBAL PROPERTY IN_TRY_COMPILE) if(NOT in_try_compile) set(CMAKE_EXECUTABLE_SUFFIX .missing) diff --git a/Tests/RunCMake/Configure/FailCopyFileABI-stdout.txt b/Tests/RunCMake/Configure/CopyFileABI-stdout.txt index 92fe233..6a856a4 100644 --- a/Tests/RunCMake/Configure/FailCopyFileABI-stdout.txt +++ b/Tests/RunCMake/Configure/CopyFileABI-stdout.txt @@ -1,4 +1,4 @@ -- Detecting C compiler ABI info --- Detecting C compiler ABI info - failed.* +-- Detecting C compiler ABI info - done.* -- Configuring done -- Generating done diff --git a/Tests/RunCMake/Configure/FailCopyFileABI.cmake b/Tests/RunCMake/Configure/CopyFileABI.cmake index 74efd97..4eee100 100644 --- a/Tests/RunCMake/Configure/FailCopyFileABI.cmake +++ b/Tests/RunCMake/Configure/CopyFileABI.cmake @@ -1,2 +1,2 @@ -set(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_SOURCE_DIR}/FailCopyFileABI-override.cmake) +set(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_SOURCE_DIR}/CopyFileABI-override.cmake) enable_language(C) diff --git a/Tests/RunCMake/Configure/FailCopyFileABI-check.cmake b/Tests/RunCMake/Configure/FailCopyFileABI-check.cmake deleted file mode 100644 index db0cb0a..0000000 --- a/Tests/RunCMake/Configure/FailCopyFileABI-check.cmake +++ /dev/null @@ -1,14 +0,0 @@ -set(log "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/CMakeError.log") -if(EXISTS "${log}") - file(READ "${log}" error_log) -else() - set(error_log "") -endif() -string(REPLACE "\r\n" "\n" regex "Cannot copy output executable.* -to destination specified by COPY_FILE:.* -Unable to find the executable at any of: - .*\\.missing") -if(NOT error_log MATCHES "${regex}") - string(REGEX REPLACE "\n" "\n " error_log " ${error_log}") - set(RunCMake_TEST_FAILED "Log file:\n ${log}\ndoes not have expected COPY_FILE failure message:\n${error_log}") -endif() diff --git a/Tests/RunCMake/Configure/RunCMakeTest.cmake b/Tests/RunCMake/Configure/RunCMakeTest.cmake index 9fd4499..750fa3c 100644 --- a/Tests/RunCMake/Configure/RunCMakeTest.cmake +++ b/Tests/RunCMake/Configure/RunCMakeTest.cmake @@ -1,9 +1,9 @@ include(RunCMake) run_cmake(ContinueAfterError) +run_cmake(CopyFileABI) run_cmake(CustomTargetAfterError) run_cmake(ErrorLogs) -run_cmake(FailCopyFileABI) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/RerunCMake-build) diff --git a/Tests/RunCMake/try_compile/BuildType.cmake b/Tests/RunCMake/try_compile/BuildType.cmake new file mode 100644 index 0000000..f2709f8 --- /dev/null +++ b/Tests/RunCMake/try_compile/BuildType.cmake @@ -0,0 +1,6 @@ +enable_language(C) +set(CMAKE_BUILD_TYPE RelWithDebInfo) + +try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c + COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/out.bin" + ) diff --git a/Tests/RunCMake/try_compile/BuildTypeAsFlag.cmake b/Tests/RunCMake/try_compile/BuildTypeAsFlag.cmake new file mode 100644 index 0000000..e9384c7 --- /dev/null +++ b/Tests/RunCMake/try_compile/BuildTypeAsFlag.cmake @@ -0,0 +1,7 @@ +enable_language(C) +set(CMAKE_BUILD_TYPE RelWithDebInfo) + +try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c + COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/out.bin" + CMAKE_FLAGS "-DCMAKE_BUILD_TYPE=Release" + ) diff --git a/Tests/RunCMake/try_compile/OutputDirAsFlag.cmake b/Tests/RunCMake/try_compile/OutputDirAsFlag.cmake new file mode 100644 index 0000000..5c4dca5 --- /dev/null +++ b/Tests/RunCMake/try_compile/OutputDirAsFlag.cmake @@ -0,0 +1,7 @@ +enable_language(C) +set(CMAKE_BUILD_TYPE RelWithDebInfo) + +try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c + COPY_FILE "${CMAKE_CURRENT_BINARY_DIR}/out.bin" + CMAKE_FLAGS "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=bin" + ) diff --git a/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake b/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake index e156e12..f80d445 100644 --- a/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake +++ b/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake @@ -11,6 +11,9 @@ run_cmake(BadSources2) run_cmake(EmptyValueArgs) run_cmake(EmptyListArgs) run_cmake(TryRunArgs) +run_cmake(BuildType) +run_cmake(BuildTypeAsFlag) +run_cmake(OutputDirAsFlag) run_cmake(EnvConfig) |