Skip to content

try_compile: Add keyword-dispatched signature

Introduce a new signature for try_compile (and try_run) which uses a unique temporary directory for output. This ensures that successive runs do not overwrite previous runs, which will simplify debugging and should also, eventually, allow us to execute multiple trials in parallel.

Notes:

  • This adds MakeTempDirectory to kwsys. This may need to be implemented on exotic platforms. The POSIX implementation

This is functional and "mostly" implemented, but still needs some work:

  • Implement the new signature.
  • Use unique directories for each invocation.
  • Update try_compile documentation.
  • Update try_run documentation.
  • Remove CMakeScratch at the beginning of a CMake run.
  • Remove temporary directory, not just contents.
    • Verify that --debug-trycompile doesn't remove anything.
  • Finish updating tests.

Issue: #22799 (closed)

Edited by Brad King

Merge request reports