# Central logging of all source and project-based try\_compile calls into a file

**URL:** https://discourse.cmake.org/t/central-logging-of-all-source-and-project-based-try-compile-calls-into-a-file/1720
**Category:** Usage
**Created:** [August 18, 2020, 11:26am UTC](https://discourse.cmake.org/t/central-logging-of-all-source-and-project-based-try-compile-calls-into-a-file/1720 "2020-08-18T11:26:55Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![alcroito](https://discourse.cmake.org/user_avatar/discourse.cmake.org/alcroito/32/186_2.png) [@alcroito](https://discourse.cmake.org/u/alcroito)
#### Post date: [August 18, 2020, 11:26am UTC](https://discourse.cmake.org/t/central-logging-of-all-source-and-project-based-try-compile-calls-into-a-file/1720/1 "2020-08-18T11:26:55Z")

</div>

Hi,

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?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [November 11, 2020, 10:18pm UTC](https://discourse.cmake.org/t/central-logging-of-all-source-and-project-based-try-compile-calls-into-a-file/1720/2 "2020-11-11T22:18:05Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [November 12, 2020, 9:03am UTC](https://discourse.cmake.org/t/central-logging-of-all-source-and-project-based-try-compile-calls-into-a-file/1720/3 "2020-11-12T09:03:17Z")

</div>

> [@ben.boeckel](#):
>
> Maybe all of them should be in a `CMakeFiles/TryCompile` directory for easy cleanup for each run?

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](https://gitlab.kitware.com/cmake/cmake/-/issues/18929).
