cmake: precompiled headers

- enable by default, could be disabled with -Ddisable-pch
    - use different pch files for Debug/Release/...
    - use only one config_pch.C 


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15549 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Peter Kümmel 2006-10-25 17:57:04 +00:00
parent 8fa888a61a
commit 4f8939dd3d

View File

@ -94,21 +94,20 @@ else(MSVC)
add_definitions(-DBOOST_USER_CONFIG="<config.h>")
endif(MSVC)
if(pch AND MSVC)
set(pch TRUE CACHE TYPE STRING)
if(MSVC AND NOT disable-pch)
configure_file(${CMAKE_SOURCE_DIR}/pcheaders.h ${CMAKE_BINARY_DIR}/pcheaders.h)
configure_file(${CMAKE_SOURCE_DIR}/config.C.cmake ${CMAKE_CURRENT_BINARY_DIR}/config_pch.C)
macro(lyx_add_msvc_pch name_)
configure_file(${CMAKE_SOURCE_DIR}/config.C.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.C)
SET_SOURCE_FILES_PROPERTIES(${${name_}_sources} PROPERTIES COMPILE_FLAGS /Yuconfig.h)
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/config.C PROPERTIES COMPILE_FLAGS /Ycconfig.h)
SET_SOURCE_FILES_PROPERTIES(${${name_}_sources} PROPERTIES COMPILE_FLAGS "/Yuconfig.h /Fp\$(IntDir)/config.pch")
SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/config_pch.C PROPERTIES COMPILE_FLAGS "/Ycconfig.h /Fp\$(IntDir)/config.pch")
add_definitions(/DLYX_PRECOMPILED_HEADERS)
set(${name_}_sources ${${name_}_sources} ${CMAKE_CURRENT_BINARY_DIR}/config.C ${CMAKE_BINARY_DIR}/pcheaders.h)
set(${name_}_sources ${${name_}_sources} ${CMAKE_BINARY_DIR}/config_pch.C ${CMAKE_BINARY_DIR}/pcheaders.h)
endmacro(lyx_add_msvc_pch)
set(PRECOMPILED_HEADERS TRUE)
else(pch AND MSVC)
else(MSVC AND NOT disable-pch)
set(disable-pch TRUE CACHE TYPE STRING)
macro(lyx_add_msvc_pch)
endmacro(lyx_add_msvc_pch)
endif(pch AND MSVC)
endif(MSVC AND NOT disable-pch)
#TODO: insource is not the best place