diff options
author | Matthew Woehlke <matthew.woehlke@kitware.com> | 2022-08-18 15:27:27 (GMT) |
---|---|---|
committer | Matthew Woehlke <matthew.woehlke@kitware.com> | 2022-08-18 15:27:27 (GMT) |
commit | 299cd3e6ab2fd1dded4953a286e665a9c51c1e0a (patch) | |
tree | 10a6376ef7b06aa894558c66bea45bb0b8b96f9f /Tests/TryCompile | |
parent | 36d35d4eb1a0cbbcf4687e021ad236cbe186a2f3 (diff) | |
download | CMake-299cd3e6ab2fd1dded4953a286e665a9c51c1e0a.zip CMake-299cd3e6ab2fd1dded4953a286e665a9c51c1e0a.tar.gz CMake-299cd3e6ab2fd1dded4953a286e665a9c51c1e0a.tar.bz2 |
try_compile: Clean up tests
Switch order of one try_compile test so that the total set of tests is
in a more sensible order. Remove two duplicate tests. Remove some
gratuitous (and not entirely accurate) messages.
Diffstat (limited to 'Tests/TryCompile')
-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 |