diff options
author | Brad King <brad.king@kitware.com> | 2022-08-19 11:22:34 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-08-19 11:22:41 (GMT) |
commit | d69d0316da2bd8ead5f9ebd03180e329a6180a1d (patch) | |
tree | eae29d38569c82e42fcaef031fc5b4c73a9a167c | |
parent | 6c7f3c839b5af6101751b2b0f09b1346e886ba86 (diff) | |
parent | 299cd3e6ab2fd1dded4953a286e665a9c51c1e0a (diff) | |
download | CMake-d69d0316da2bd8ead5f9ebd03180e329a6180a1d.zip CMake-d69d0316da2bd8ead5f9ebd03180e329a6180a1d.tar.gz CMake-d69d0316da2bd8ead5f9ebd03180e329a6180a1d.tar.bz2 |
Merge topic 'try_compile-clean-up-tests'
299cd3e6ab try_compile: Clean up tests
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7591
-rw-r--r-- | Tests/TryCompile/CMakeLists.txt | 46 |
1 files changed, 10 insertions, 36 deletions
diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt index 7c6f970..dccc227 100644 --- a/Tests/TryCompile/CMakeLists.txt +++ b/Tests/TryCompile/CMakeLists.txt @@ -30,6 +30,15 @@ endmacro() # try to compile a file that should compile +try_compile(SHOULD_PASS + ${TryCompile_BINARY_DIR} + ${TryCompile_SOURCE_DIR}/pass.c + OUTPUT_VARIABLE TRY_OUT) +if(NOT SHOULD_PASS) + message(SEND_ERROR "should pass failed ${TRY_OUT}") +endif() + +# try to compile a file that should compile # also check that COPY_FILE works try_compile(SHOULD_PASS ${TryCompile_BINARY_DIR} @@ -73,24 +82,6 @@ if(SHOULD_FAIL) message(SEND_ERROR "Should fail passed ${TRY_OUT}") endif() -# try to compile a file that should compile -try_compile(SHOULD_PASS - ${TryCompile_BINARY_DIR} - ${TryCompile_SOURCE_DIR}/pass.c - OUTPUT_VARIABLE TRY_OUT) -if(NOT SHOULD_PASS) - message(SEND_ERROR "should pass failed ${TRY_OUT}") -endif() - -# try to compile a file that should not compile -try_compile(SHOULD_FAIL - ${TryCompile_BINARY_DIR} - ${TryCompile_SOURCE_DIR}/fail.c - OUTPUT_VARIABLE TRY_OUT) -if(SHOULD_FAIL) - message(SEND_ERROR "Should fail passed ${TRY_OUT}") -endif() - # try to compile two files that should compile try_compile(SHOULD_PASS ${TryCompile_BINARY_DIR} @@ -125,24 +116,6 @@ if(NOT SHOULD_PASS) endif() set(CMAKE_C_FLAGS "${_c_flags}") -if(NOT SHOULD_FAIL) - if(SHOULD_PASS) - message("All Tests passed, ignore all previous output.") - else() - message("Test failed") - endif() -else() - message("Test failed") -endif() -try_compile(CMAKE_ANSI_FOR_SCOPE - ${TryCompile_BINARY_DIR} - ${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx OUTPUT_VARIABLE OUT) -if (CMAKE_ANSI_FOR_SCOPE) - message("Compiler supports ansi for") -else() - message("Compiler does not support ansi for scope") -endif() - try_compile(CMAKE_ANSI_FOR_SCOPE ${TryCompile_BINARY_DIR} ${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx OUTPUT_VARIABLE OUT) @@ -160,6 +133,7 @@ else() message("Compiler does not support ansi for scope") endif() +# try to compile a project message("Testing try_compile project mode") try_compile(TEST_INNER ${TryCompile_BINARY_DIR}/CMakeFiles/Inner |