diff options
author | Brad King <brad.king@kitware.com> | 2023-01-23 15:34:19 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-01-23 15:34:37 (GMT) |
commit | f4d604f77f5837fc7671fddc26974c626dea8bea (patch) | |
tree | a150dddc35fcde86209ebbff6b6347263994fb4a /Tests | |
parent | adac7f3ca41ae38248f62ce48000390143762e99 (diff) | |
parent | faa950a155b1654e42c193c2016cdc69e9bb9c85 (diff) | |
download | CMake-f4d604f77f5837fc7671fddc26974c626dea8bea.zip CMake-f4d604f77f5837fc7671fddc26974c626dea8bea.tar.gz CMake-f4d604f77f5837fc7671fddc26974c626dea8bea.tar.bz2 |
Merge topic 'try_compile-verbose'
faa950a155 try_compile: Run native build tool with verbose output
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8095
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/try_compile/ISPCTargets-stderr.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/RunCMakeTest.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/Verbose.c | 7 | ||||
-rw-r--r-- | Tests/RunCMake/try_compile/Verbose.cmake | 15 |
4 files changed, 25 insertions, 1 deletions
diff --git a/Tests/RunCMake/try_compile/ISPCTargets-stderr.txt b/Tests/RunCMake/try_compile/ISPCTargets-stderr.txt index 72e0a01..91dfa6d 100644 --- a/Tests/RunCMake/try_compile/ISPCTargets-stderr.txt +++ b/Tests/RunCMake/try_compile/ISPCTargets-stderr.txt @@ -1 +1 @@ -.*Linking ISPC static library* +(Linking ISPC static library|[ \/]libcmTC_[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]\.a|out:([A-Za-z]+[\/])?cmTC_[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]\.lib) diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake index 51ccac8..29c0538 100644 --- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake @@ -45,6 +45,8 @@ run_cmake(ProjectCopyFile) run_cmake(NonSourceCopyFile) run_cmake(NonSourceCompileDefinitions) +run_cmake(Verbose) + set(RunCMake_TEST_OPTIONS --debug-trycompile) run_cmake(PlatformVariables) run_cmake(WarnDeprecated) diff --git a/Tests/RunCMake/try_compile/Verbose.c b/Tests/RunCMake/try_compile/Verbose.c new file mode 100644 index 0000000..5953879 --- /dev/null +++ b/Tests/RunCMake/try_compile/Verbose.c @@ -0,0 +1,7 @@ +#ifndef EXAMPLE_DEFINITION +# error "EXAMPLE_DEFINITION not defined." +#endif +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/try_compile/Verbose.cmake b/Tests/RunCMake/try_compile/Verbose.cmake new file mode 100644 index 0000000..3f2a7dd --- /dev/null +++ b/Tests/RunCMake/try_compile/Verbose.cmake @@ -0,0 +1,15 @@ +enable_language(C) + +try_compile(COMPILE_RESULT + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Verbose.c + COMPILE_DEFINITIONS -DEXAMPLE_DEFINITION + OUTPUT_VARIABLE out + ) +string(REPLACE "\n" "\n " out " ${out}") +if(NOT COMPILE_RESULT) + message(FATAL_ERROR "try_compile failed:\n${out}") +endif() +if(NOT out MATCHES "EXAMPLE_DEFINITION" + AND NOT CMAKE_GENERATOR MATCHES "NMake|Borland") + message(FATAL_ERROR "try_compile output does not contain EXAMPLE_DEFINITION:\n${out}") +endif() |