Files
CMake/Tests/RunCMake/try_compile/Verbose.cmake
T
Brad King faa950a155 try_compile: Run native build tool with verbose output
Make the compiler command lines visible in the configure log.

Issue: #23200
2023-01-20 09:17:51 -05:00

16 lines
481 B
CMake

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()