[CMake] compile header file for precompiled gcc headers

frederic heem frederic.heem at telsey.it
Wed Dec 20 06:28:40 EST 2006


On Monday 18 December 2006 1:47 pm, Maik Beckmann wrote:
> Am Montag, den 18.12.2006, 13:33 +0100 schrieb Maik Beckmann:
>
>
> Even more intelligent ;)
>
> Maik
Hi,

The new macro generates an error:
CMake Error: Error in cmake code at
/home/heefre/svn/trunk/voxgratia/OpalTester/cmake/modules/FindXSD.cmake:55:
IF had incorrect arguments: ${item} STREQUAL ${_path} AND NOT 
_CMAKE_CURRENT_BINARY_DIR_included_before_path (Unknown arguments specified).
Current CMake 
stack: /home/heefre/svn/trunk/voxgratia/OpalTester/src/CMakeLists.txt
CMake Error: This is the ADD_PRECOMPILED_HEADER macro. CMAKE_CURREN_BINARY_DIR 
has to mentioned at INCLUDE_DIRECTORIES's argument list before , where 
PreCompiled.h is located


Note that cmake has a bug in which it reports the error at FindXSD.cmake:55, 
whereas the mistake is in PCHSupport.cmake. 
Then the marco tries to copy the precompiled header to the build directory but 
fails because the source file doesn't contain the full path, here is the 
modification:
	ADD_CUSTOM_COMMAND(
		OUTPUT	${CMAKE_CURRENT_BINARY_DIR}/${_name} 
		COMMAND ${CMAKE_COMMAND} -E copy  ${CMAKE_CURRENT_SOURCE_DIR}/${_input} 
${CMAKE_CURRENT_BINARY_DIR}/${_name} # ensure same directory! Required by gcc
	)

The cmake version  is  cmake version 2.5-20061218
By the way, precompiled header on linux/gcc3.4 has decreased compiled time by 
30 % on one library. Precompiled header is worth it ! 
Thanks
Frederic





More information about the CMake mailing list