diff --git a/development/cmake/CMakeLists.txt b/development/cmake/CMakeLists.txt index 3ebe53bd78..3b6e8ffde6 100644 --- a/development/cmake/CMakeLists.txt +++ b/development/cmake/CMakeLists.txt @@ -98,9 +98,11 @@ if(MSVC AND NOT disable-pch) 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") set(${name_}_sources ${${name_}_sources} ${CMAKE_BINARY_DIR}/config_pch.C ${CMAKE_BINARY_DIR}/pcheaders.h) + add_definitions(/DLYX_ENABLE_PCH) endmacro(lyx_add_msvc_pch) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /DLYX_PCH_STL /DLYX_PCH_BOOST /DLYX_PCH_QT4") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /DLYX_PCH_STL /DLYX_PCH_BOOST /DLYX_PCH_QT4") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /DLYX_PCH_STL /DLYX_PCH_BOOST /DLYX_PCH_QT4") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /DLYX_PCH_STL /DLYX_PCH_BOOST /DLYX_PCH_QT4") + set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /DLYX_PCH_STL /DLYX_PCH_BOOST") else(MSVC AND NOT disable-pch) set(disable-pch TRUE CACHE TYPE STRING) diff --git a/development/cmake/README.cmake b/development/cmake/README.cmake index a6f7168052..02900f90a1 100644 --- a/development/cmake/README.cmake +++ b/development/cmake/README.cmake @@ -23,6 +23,10 @@ Building Visual C++ 2005 project files: TIPS: - rename Microsoft Visual Studio 8\VC\vcpackages\feacp.dll to disable Intellisense - the Release build links much faster + - for the Debug and Release build all precompiled headers are enabled + to compile without pch (to check if all necessary headers are included) + * use MinSizeRel which only precompiles the STL and Boost headers + * use RelWithDebInfo which does not use any precompiled headers Building with GCC/Linux: diff --git a/development/cmake/config.h.cmake b/development/cmake/config.h.cmake index 74b097e3b1..f08c853ef6 100644 --- a/development/cmake/config.h.cmake +++ b/development/cmake/config.h.cmake @@ -168,6 +168,8 @@ #pragma warning( disable : 4800 ) //: forcing value to bool 'true' or 'false' (performance warning) #endif +#ifdef LYX_ENABLE_PCH #include "pcheaders.h" +#endif #endif