[CMake] Issues with CMakeOutput.log and CMakeError.log

Bill Hoffman bill.hoffman at kitware.com
Sun Feb 17 17:38:40 EST 2008


Bill Lorensen wrote:
> Folks,
> 
> Most CMake projects use TRY_COMPILE and CMake macros to test for include 
> files, flags, capabilities of the compiler etc. The CMake/Modules macros 
> append the output of these commands to 
> ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log or 
> ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log. The location 
> of these files is by convention.
> 
> 1) The CMake/Module/CheckIncludeFiles.cmake stores its output in : 
> ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log. 
> Note the duplicate use of  ${CMAKE_FILES_DIRECTORY}. Is this a bug?
> 
Yup, sounds like a bug...  I will fix it.

> 2) ITK and Slicer3 (and I suspect other cmake projects)  do not remove 
> these two files. Consequently, these two files grow over time since the 
> output is APPENDed. Certainly if a project cleans its 
> ${CMAKE_BINARY_DIR} before each build, then this is not a problem. But 
> in ITK and Slicer3, many of our builds are not cleaned routinely. I 
> looked at a couple of my nightly and continuous builds and they had very 
> large log files. I have modified the ITK CMakeLists.txt to remove the 
> CMakeOutput.log and CMakeError.log files.
> 
The problem is if you clear it out each time CMake is run, then you 
won't get to see the output from previous runs, and might loose some 
information.   CMake will re-run anytime a cmake input file is changed. 
I would think it would be better to put the remove into the continuous 
script or the nightly script instead of the CMakeLists.txt file for ITK. 
  If there are issues, these files are very useful to have when 
debugging build problems for ITK.
> 3) That brings me to a project-specific issue. I noticed that ITK 
> sometimes APPENDs the output to ${CMAKE_BINARY_DIR}/CMakeOutput.log and 
> other times to 
> ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log. So, we have 
> to REMOVE both files. That's when I discovered the 3rd location used in 
> CheckIncludeFiles.cmake.

All this stuff should be in 
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}.  The CMAKE_FILES_DIRECTORY 
was added in 2.4.X, so ITK must have some files that pre-date that feature.

-Bill


More information about the CMake mailing list