CMake 3.26 introduced CMakeConfigureLog.yaml, which is machine-readable. While we hard-code the location relative to the CMake build directory in this simple example, it is possible toprogrammatically locate it.
The plain trycompile is there just to show in CMakeConfigureLog.yaml how it's distinct from check_source_compiles() in the log.
First configure CMake:
cmake -B build
Then use Python scripts desired:
Check that CMake tests passed. This could be useful for known system configurations e.g. CI to help check that a malicious user hasn't tampered with feature detections:
python CheckPass.py build imp2 imp1 imp3
Print CMake trycompile() results from CMakeConfigureLog.yaml:
python PrintTryCompile.py build