[CMake] Problem using ccache & cmake

Steven Van Ingelgem steven at vaningelgem.be
Mon Nov 5 10:24:51 EST 2007


Hi,


I had a problem trying to use ccache with cmake the following way:


$ export GCC="ccache gcc"
$ export CC="ccache cc"
$ export CXX="ccache g++"
$ cmake . (in the root of the -clean- CMake CVS directory)

This resulted in the following output:
$ rm CMakeCache.txt CMakeFiles/ -Rf && cmake .
CMake Error: Compiling the C compiler identification source file
"/usr/local/share/cmake-2.5/Modules/CMakeCCompilerId.c" failed with
the following output:
1
 /usr/bin/cc: No such file or directory



CMake Error: Error required internal CMake variable not set, cmake may
be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Could not find cmake module
file:/src/CMake/CMakeFiles/CMakeCCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may
be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may
be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module
file:/src/CMake/CMakeFiles/CMakeCXXCompiler.cmake
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring done


as you can see the output from the "CMAKE_DETERMINE_COMPILER_ID" in
CMakeDetermineCCompiler.cmake returns " /usr/bin/cc: No such file or
directory"

However if I execute this line in the
"/src/CMake/CMakeFiles/CompilerIdC" directory:
/usr/bin/ccache /usr/bin/cc
/usr/local/share/cmake-2.5/Modules/CMakeCCompilerId.c

It creates the a.out file... (and returns the required '0' as errorlevel).

The following are some helpfull variables which I placed in the macro:
CMAKE_C_COMPILER: /usr/bin/ccache
CMAKE_C_COMPILER_ARG1:  /usr/bin/cc
CMAKE_C_COMPILER_ID_FLAGS_LIST:
CMAKE_C_COMPILER_ID_SRC: /usr/local/share/cmake-2.5/Modules/CMakeCCompilerId.c
CMAKE_C_COMPILER_ID_DIR: /src/CMake/CMakeFiles/CompilerIdC
CMAKE_C_COMPILER_ID_OUTPUT:  /usr/bin/cc: No such file or directory

CMAKE_C_COMPILER_ID_RESULT: 1


Hopefully someone might be able to understand why it happens like
that, but to me it looks like it's somewhere in the execute_process
function.


Greetings,
Steven


More information about the CMake mailing list