CMake/Tests/RunCMake/CommandLine/trycompile-clean.cmake
Matthew Woehlke 2edf0fc6d7 Modules: Use new keyword-dispatched try_compile signature
Modify most of the modules that ship with CMake to use the new
try_compile / try_run signatures added by commit aa9220d3a0
(try_compile: Add keyword-dispatched signature, 2022-09-02). This
improves debugging by each invocation using its own directory so that
the results of multiple invocations can be retained.

This does not cover any invocations which provide an entire project, as
that flavor of try_compile has not yet been updated.
2022-09-14 07:52:16 -04:00

9 lines
297 B
CMake

enable_language(C)
# Look for a source tree left by enable_language internal checks.
set(scratch ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeScratch)
file(GLOB_RECURSE remnants ${scratch}/TryCompile-*/*)
if(remnants)
message(FATAL_ERROR "try_compile should not leave artifacts behind")
endif()