try_compile: Provide central logging for all try_compile calls
Initially inquired here https://discourse.cmake.org/t/central-logging-of-all-source-and-project-based-try-compile-calls-into-a-file/1720
It would be useful to provide central logging of all 'try_compile
-like' calls that would include:
- exact cmake arguments used during their configuration
- output of the cmake configuration
- verbose stdout and stderr output of building the projects
This would include both source-based and project-based try_compile
calls.
I mention 'try-compile-like' because it would be great if it also included the output of the initial language detection that CMake does at the beginning of each project.
Use case:
When configuring a complex project, some try_compile
calls might fail. Troubleshooting them can be complicated, especially if you're a new CMake user. Having a central location can make that considerably easier.
As mentioned in the initial link, the current implementation of CMakeFiles/CMakeError.log
and CMakeFiles/CMakeOutput.log
are not sufficient.
A bit of brainstorming, potential forms the the logging could take:
- one single file
CMakeTryCompileLog.txt
- multiple files
CMakeTryCompileCallsLog.txt
for the cmake commands,CMakeTryCompileConfigureLog.txt
for the configure output,CMakeTryCompileBuildLog.txt
for the stdout/stderr of the build. - something in-between