diff options
author | Brad King <brad.king@kitware.com> | 2023-01-18 22:01:21 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-01-20 14:17:51 (GMT) |
commit | faa950a155b1654e42c193c2016cdc69e9bb9c85 (patch) | |
tree | 7006dd9a23eb3892153bdf5d712b874294dd4185 /Tests/RunCMake/try_compile/Verbose.cmake | |
parent | 5031934fb05181eb925b81f6747feaa8ffa27787 (diff) | |
download | CMake-faa950a155b1654e42c193c2016cdc69e9bb9c85.zip CMake-faa950a155b1654e42c193c2016cdc69e9bb9c85.tar.gz CMake-faa950a155b1654e42c193c2016cdc69e9bb9c85.tar.bz2 |
try_compile: Run native build tool with verbose output
Make the compiler command lines visible in the configure log.
Issue: #23200
Diffstat (limited to 'Tests/RunCMake/try_compile/Verbose.cmake')
-rw-r--r-- | Tests/RunCMake/try_compile/Verbose.cmake | 15 |
1 files changed, 15 insertions, 0 deletions
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() |