Central logging of all source and project-based try_compile calls into a file


Is it possible to somehow redirect the configuration of all try_compile calls (source and project based) to stdout or to a file, and also the full verbose build commands used?

CMakeFiles/CMakeOutput.log and CMakeFiles/CMakeError.log seem to be contain info only for source based try_compile calls, and CMakeOutput.log doesn’t contain the full verbose build command. Only CMakeErrorLog contains the full failing build command, but of course only if it fails.

I’m aware of --debug-trycompile but that only works for one compile test.

The intention is to use the feature in a CI environment to have a complete log file for troubleshooting issues.

I suspect there is no such feature, so would it be feasible to add it? Any known blockers why that would not be achievable?

This has been something I’ve wanted a few times. I don’t know what barriers would exist to this being implemented though. Cleanup should happen somewhere though. Maybe all of them should be in a CMakeFiles/TryCompile directory for easy cleanup for each run?

@brad.king @kyle.edwards @craig.scott Thoughts?

That idea has merit. You could clear the contents of that directory at the start of each CMake run, then create a numbered subdirectory below it for each try_compile() invocation. This would have the added benefit of avoiding race conditions if we ever figure out how to run multiple try_compile() calls in parallel.