Files
CMake/Tests/RunCMake/try_compile/ConfigureLog.cmake
T
Brad King 48292c8624 try_compile: Record stack of in-progess checks in configure log
Many `try_compile` and `try_run` calls occur inside check modules
between `message(CHECK_START)` and `message(CHECK_{PASS,FAIL})` pairs.
Add a field to configure log entries to report this context.

Issue: #23200
2023-01-16 17:18:07 -05:00

26 lines
618 B
CMake

enable_language(C)
try_compile(COMPILE_RESULT
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-bad.c
LOG_DESCRIPTION "Source that should not compile."
)
try_compile(COMPILE_RESULT
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c
NO_LOG
)
message(CHECK_START "Check 1")
message(CHECK_START "Check 2")
try_compile(COMPILE_RESULT
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c
LOG_DESCRIPTION "Source that should compile."
)
if (COMPILE_RESULT)
message(CHECK_PASS "passed")
message(CHECK_PASS "passed")
else()
message(CHECK_FAIL "failed")
message(CHECK_FAIL "failed")
endif()