]> git.lyx.org Git - features.git/commitdiff
cmake: add pch for gcc, it's sooo hairy, disable by default
authorPeter Kümmel <syntheticpp@gmx.net>
Thu, 3 Dec 2009 21:58:44 +0000 (21:58 +0000)
committerPeter Kümmel <syntheticpp@gmx.net>
Thu, 3 Dec 2009 21:58:44 +0000 (21:58 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32303 a592a061-630c-0410-9148-cb99ea01b6c8

development/cmake/CMakeLists.txt
development/cmake/modules/PCHSupport_26.cmake [new file with mode: 0644]
development/cmake/pcheaders.h
development/cmake/src/CMakeLists.txt
development/cmake/src/frontends/CMakeLists.txt
development/cmake/src/frontends/qt4/CMakeLists.txt
development/cmake/src/graphics/CMakeLists.txt
development/cmake/src/insets/CMakeLists.txt
development/cmake/src/mathed/CMakeLists.txt
development/cmake/src/support/CMakeLists.txt

index af6a1d0095ae1f8199f57308e2d4a8e257e52eee..ba8f746e1c7b45191c3cde01dcaca7b606e41849 100644 (file)
@@ -11,17 +11,20 @@ if(COMMAND cmake_policy)
        cmake_policy(SET CMP0005 OLD)
 endif(COMMAND cmake_policy)
 
-set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
-
 project(lyx)
 
-option(lyxinstall "Build install projects/rules" ON)
+set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
 
 # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/
 # is checked
 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
 set(EXECUTABLE_OUTPUT_PATH  ${CMAKE_BINARY_DIR}/bin)
 
+
+option(lyxinstall "Build install projects/rules" ON)
+
+
+
 # Supress regeneration
 set(CMAKE_SUPPRESS_REGENERATION TRUE)
 
@@ -262,29 +265,46 @@ endforeach(_v)
 message(STATUS "")
 
 
-if(MSVC AND NOT disable-pch AND NOT MERGE_FILES)
+# PCHs not supported by cmake: http://www.cmake.org/Bug/view.php?id=1260
+# Not sure if it works for all non-msvc compilers
+include(PCHSupport_26)
+if (MSVC)
+       option(disable-pch "Disable precompiled headers" OFF)
+else()
+       option(disable-pch "Disable precompiled headers" ON)
+endif()
+
+if(NOT disable-pch)
+
        message(STATUS "-----")
        message(STATUS "----- using precompiled headers, disable with -Ddisable-pch=1")
        message(STATUS "-----")
-       configure_file(${CMAKE_SOURCE_DIR}/pcheaders.h
-               ${CMAKE_BINARY_DIR}/pcheaders.h)
-       configure_file(${CMAKE_SOURCE_DIR}/config.cpp.cmake
-               ${CMAKE_BINARY_DIR}/config_pch.cpp)
-       macro(lyx_add_msvc_pch name_)
-               set_source_files_properties(${${name_}_sources} PROPERTIES
-                       COMPILE_FLAGS "/Yuconfig.h /Fp\$(IntDir)/config.pch")
-               set_source_files_properties(${CMAKE_BINARY_DIR}/config_pch.cpp PROPERTIES
-                       COMPILE_FLAGS "/Ycconfig.h /Fp\$(IntDir)/config.pch")
-               set(${name_}_sources ${${name_}_sources} ${CMAKE_BINARY_DIR}/config_pch.cpp
-                       ${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_MINSIZEREL
-               "${CMAKE_CXX_FLAGS_MINSIZEREL} /DLYX_PCH_STL /DLYX_PCH_BOOST")
+       configure_file(${CMAKE_SOURCE_DIR}/pcheaders.h ${CMAKE_BINARY_DIR}/pcheaders.h)
+       configure_file(${CMAKE_SOURCE_DIR}/config.cpp.cmake ${CMAKE_BINARY_DIR}/config_pch.cpp)
+
+
+       if(MSVC AND NOT MERGE_FILES)
+               macro(lyx_add_msvc_pch name_)
+                       set_source_files_properties(${${name_}_sources} PROPERTIES
+                               COMPILE_FLAGS "/Yuconfig.h /Fp\$(IntDir)/config.pch")
+                       set_source_files_properties(${CMAKE_BINARY_DIR}/config_pch.cpp PROPERTIES
+                               COMPILE_FLAGS "/Ycconfig.h /Fp\$(IntDir)/config.pch")
+                       set(${name_}_sources ${${name_}_sources} ${CMAKE_BINARY_DIR}/config_pch.cpp
+                               ${CMAKE_BINARY_DIR}/pcheaders.h)
+                       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")                  
+               endmacro(lyx_add_msvc_pch)
+               macro(lyx_add_gcc_pch name_)
+               endmacro()
+       else()
+               macro(lyx_add_msvc_pch name_)
+               endmacro()
+               macro(lyx_add_gcc_pch name_)
+                       add_definitions(-DLYX_ENABLE_PCH -DLYX_PCH_STL -DLYX_PCH_BOOST -DLYX_PCH_QT4)
+                       ADD_PRECOMPILED_HEADER(${name_} ${CMAKE_BINARY_DIR}/config_pch.cpp ${CMAKE_BINARY_DIR}/config.h.gch)
+               endmacro()
+       endif()
 else()
        if(MSVC)
                message(STATUS "-----")
@@ -294,6 +314,8 @@ else()
        set(disable-pch TRUE CACHE TYPE STRING)
        macro(lyx_add_msvc_pch)
        endmacro(lyx_add_msvc_pch)
+       macro(lyx_add_gcc_pch name_)
+       endmacro()
 endif()
 
 if(MSVC)
diff --git a/development/cmake/modules/PCHSupport_26.cmake b/development/cmake/modules/PCHSupport_26.cmake
new file mode 100644 (file)
index 0000000..a31ffa3
--- /dev/null
@@ -0,0 +1,319 @@
+# - Try to find precompiled headers support for GCC 3.4 and 4.x
+# Once done this will define:
+#
+# Variable:
+#   PCHSupport_FOUND
+#
+# Macro:
+#   ADD_PRECOMPILED_HEADER  _targetName _input  _dowarn
+#   ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use _dowarn
+#   ADD_NATIVE_PRECOMPILED_HEADER _targetName _input _dowarn
+#   GET_NATIVE_PRECOMPILED_HEADER _targetName _input
+
+IF(CMAKE_COMPILER_IS_GNUCXX)
+
+    EXEC_PROGRAM(
+       ${CMAKE_CXX_COMPILER}  
+        ARGS   ${CMAKE_CXX_COMPILER_ARG1} -dumpversion 
+        OUTPUT_VARIABLE gcc_compiler_version)
+    #MESSAGE("GCC Version: ${gcc_compiler_version}")
+    IF(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]")
+        SET(PCHSupport_FOUND TRUE)
+    ELSE(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]")
+        IF(gcc_compiler_version MATCHES "3\\.4\\.[0-9]")
+            SET(PCHSupport_FOUND TRUE)
+        ENDIF(gcc_compiler_version MATCHES "3\\.4\\.[0-9]")
+    ENDIF(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]")
+    
+       SET(_PCH_include_prefix "-I")
+       
+ELSE(CMAKE_COMPILER_IS_GNUCXX)
+       IF(WIN32)       
+               SET(PCHSupport_FOUND TRUE) # for experimental msvc support
+               SET(_PCH_include_prefix "/I")
+       ELSE(WIN32)
+               SET(PCHSupport_FOUND FALSE)
+       ENDIF(WIN32)    
+ENDIF(CMAKE_COMPILER_IS_GNUCXX)
+
+
+MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
+
+
+  STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name)
+  SET(${_out_compile_flags} ${${_flags_var_name}} )
+  
+  IF(CMAKE_COMPILER_IS_GNUCXX)
+    
+    GET_TARGET_PROPERTY(_targetType ${_PCH_current_target} TYPE)
+    IF(${_targetType} STREQUAL SHARED_LIBRARY)
+      LIST(APPEND ${_out_compile_flags} "${${_out_compile_flags}} -fPIC")
+    ENDIF(${_targetType} STREQUAL SHARED_LIBRARY)
+    
+  ELSE(CMAKE_COMPILER_IS_GNUCXX)
+    ## TODO ... ? or does it work out of the box 
+  ENDIF(CMAKE_COMPILER_IS_GNUCXX)
+  
+  GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES )
+  FOREACH(item ${DIRINC})
+    LIST(APPEND ${_out_compile_flags} "${_PCH_include_prefix}${item}")
+  ENDFOREACH(item)
+  
+  GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
+  #MESSAGE("_directory_flags ${_directory_flags}" )
+  LIST(APPEND ${_out_compile_flags} ${_directory_flags})
+  LIST(APPEND ${_out_compile_flags} ${CMAKE_CXX_FLAGS} )
+  
+  SEPARATE_ARGUMENTS(${_out_compile_flags})
+
+ENDMACRO(_PCH_GET_COMPILE_FLAGS)
+
+
+MACRO(_PCH_WRITE_PCHDEP_CXX _targetName _include_file _dephelp)
+
+  SET(${_dephelp} ${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch_dephelp.cxx)
+  FILE(WRITE  ${${_dephelp}}
+"#include \"${_include_file}\" 
+int testfunction()
+{
+    return 0;
+}
+"
+    ) 
+
+ENDMACRO(_PCH_WRITE_PCHDEP_CXX )
+
+MACRO(_PCH_GET_COMPILE_COMMAND out_command _input _output)
+
+       FILE(TO_NATIVE_PATH ${_input} _native_input)
+       FILE(TO_NATIVE_PATH ${_output} _native_output)
+       
+
+       IF(CMAKE_COMPILER_IS_GNUCXX)
+          IF(CMAKE_CXX_COMPILER_ARG1)
+           # remove leading space in compiler argument
+            STRING(REGEX REPLACE "^ +" "" pchsupport_compiler_cxx_arg1 ${CMAKE_CXX_COMPILER_ARG1})
+
+           SET(${out_command} 
+             ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS}   -x c++-header -o ${_output} ${_input} 
+             )
+         ELSE(CMAKE_CXX_COMPILER_ARG1)
+           SET(${out_command} 
+             ${CMAKE_CXX_COMPILER}  ${_compile_FLAGS}  -x c++-header -o ${_output} ${_input} 
+             )
+          ENDIF(CMAKE_CXX_COMPILER_ARG1)
+       ELSE(CMAKE_COMPILER_IS_GNUCXX)
+               
+               SET(_dummy_str "#include <${_input}>")
+               FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pch_dummy.cpp ${_dummy_str})
+       
+               SET(${out_command} 
+                       ${CMAKE_CXX_COMPILER} ${_compile_FLAGS} /c /Fp${_native_output} /Yc${_native_input} pch_dummy.cpp
+               )       
+               #/out:${_output}
+
+       ENDIF(CMAKE_COMPILER_IS_GNUCXX)
+       
+ENDMACRO(_PCH_GET_COMPILE_COMMAND )
+
+
+
+MACRO(_PCH_GET_TARGET_COMPILE_FLAGS _cflags  _header_name _pch_path _dowarn )
+
+  FILE(TO_NATIVE_PATH ${_pch_path} _native_pch_path)
+  
+  IF(CMAKE_COMPILER_IS_GNUCXX)
+    # for use with distcc and gcc >4.0.1 if preprocessed files are accessible
+    # on all remote machines set
+    # PCH_ADDITIONAL_COMPILER_FLAGS to -fpch-preprocess
+    # if you want warnings for invalid header files (which is very inconvenient
+    # if you have different versions of the headers for different build types
+    # you may set _pch_dowarn
+    IF (_dowarn)
+      SET(${_cflags} "${PCH_ADDITIONAL_COMPILER_FLAGS} -include ${CMAKE_CURRENT_BINARY_DIR}/${_header_name} -Winvalid-pch " )
+    ELSE (_dowarn)
+      SET(${_cflags} "${PCH_ADDITIONAL_COMPILER_FLAGS} -include ${CMAKE_CURRENT_BINARY_DIR}/${_header_name} " )
+    ENDIF (_dowarn)
+  ELSE(CMAKE_COMPILER_IS_GNUCXX)
+    
+    set(${_cflags} "/Fp${_native_pch_path} /Yu${_header_name}" )       
+    
+  ENDIF(CMAKE_COMPILER_IS_GNUCXX)      
+  
+ENDMACRO(_PCH_GET_TARGET_COMPILE_FLAGS )
+
+MACRO(GET_PRECOMPILED_HEADER_OUTPUT _targetName _input _output)
+  GET_FILENAME_COMPONENT(_name ${_input} NAME)
+  GET_FILENAME_COMPONENT(_path ${_input} PATH)
+  SET(_output "${CMAKE_CURRENT_BINARY_DIR}/${_name}.gch/${_targetName}_${CMAKE_BUILD_TYPE}.h++")
+ENDMACRO(GET_PRECOMPILED_HEADER_OUTPUT _targetName _input)
+
+
+MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use )
+   
+  # to do: test whether compiler flags match between target  _targetName
+  # and _pch_output_to_use
+  GET_FILENAME_COMPONENT(_name ${_input} NAME)
+
+  IF( "${ARGN}" STREQUAL "0")
+    SET(_dowarn 0)
+  ELSE( "${ARGN}" STREQUAL "0")
+    SET(_dowarn 1)
+  ENDIF("${ARGN}" STREQUAL "0")
+
+
+  _PCH_GET_TARGET_COMPILE_FLAGS(_target_cflags ${_name} ${_pch_output_to_use} ${_dowarn})
+  #   MESSAGE("Add flags ${_target_cflags} to ${_targetName} " )
+  SET_TARGET_PROPERTIES(${_targetName} 
+    PROPERTIES 
+    COMPILE_FLAGS ${_target_cflags} 
+    )
+
+  ADD_CUSTOM_TARGET(pch_Generate_${_targetName}
+    DEPENDS    ${_pch_output_to_use} 
+    )
+  
+  ADD_DEPENDENCIES(${_targetName} pch_Generate_${_targetName} )
+  
+ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET)
+
+MACRO(ADD_PRECOMPILED_HEADER _targetName _input)
+
+  SET(_PCH_current_target ${_targetName})
+  
+  IF(NOT CMAKE_BUILD_TYPE)
+    MESSAGE(FATAL_ERROR 
+      "This is the ADD_PRECOMPILED_HEADER macro. " 
+      "You must set CMAKE_BUILD_TYPE!"
+      )
+  ENDIF(NOT CMAKE_BUILD_TYPE)
+
+  IF( "${ARGN}" STREQUAL "0")
+    SET(_dowarn 0)
+  ELSE( "${ARGN}" STREQUAL "0")
+    SET(_dowarn 1)
+  ENDIF("${ARGN}" STREQUAL "0")
+
+
+  GET_FILENAME_COMPONENT(_name ${_input} NAME)
+  GET_FILENAME_COMPONENT(_path ${_input} PATH)
+  GET_PRECOMPILED_HEADER_OUTPUT( ${_targetName} ${_input} _output)
+
+  GET_FILENAME_COMPONENT(_outdir ${_output} PATH )
+
+  GET_TARGET_PROPERTY(_targetType ${_PCH_current_target} TYPE)
+   _PCH_WRITE_PCHDEP_CXX(${_targetName} ${_input} _pch_dephelp_cxx)
+
+  IF(${_targetType} STREQUAL SHARED_LIBRARY)
+    ADD_LIBRARY(${_targetName}_pch_dephelp SHARED ${_pch_dephelp_cxx} )
+  ELSE(${_targetType} STREQUAL SHARED_LIBRARY)
+    ADD_LIBRARY(${_targetName}_pch_dephelp STATIC ${_pch_dephelp_cxx})
+  ENDIF(${_targetType} STREQUAL SHARED_LIBRARY)
+
+  FILE(MAKE_DIRECTORY ${_outdir})
+
+  
+  _PCH_GET_COMPILE_FLAGS(_compile_FLAGS)
+  
+  #MESSAGE("_compile_FLAGS: ${_compile_FLAGS}")
+  #message("COMMAND ${CMAKE_CXX_COMPILER}      ${_compile_FLAGS} -x c++-header -o ${_output} ${_input}")
+  SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/${_name} PROPERTIES GENERATED 1)
+  ADD_CUSTOM_COMMAND(
+   OUTPUT      ${CMAKE_CURRENT_BINARY_DIR}/${_name} 
+   COMMAND ${CMAKE_COMMAND} -E copy  ${_input} ${CMAKE_CURRENT_BINARY_DIR}/${_name} # ensure same directory! Required by gcc
+   DEPENDS ${_input}
+  )
+  
+  #message("_command  ${_input} ${_output}")
+  _PCH_GET_COMPILE_COMMAND(_command  ${CMAKE_CURRENT_BINARY_DIR}/${_name} ${_output} )
+  
+  #message(${_input} )
+  #message("_output ${_output}")
+
+  ADD_CUSTOM_COMMAND(
+    OUTPUT ${_output}  
+    COMMAND ${_command}
+    DEPENDS ${_input}   ${CMAKE_CURRENT_BINARY_DIR}/${_name} ${_targetName}_pch_dephelp
+   )
+
+
+  ADD_PRECOMPILED_HEADER_TO_TARGET(${_targetName} ${_input}  ${_output} ${_dowarn})
+ENDMACRO(ADD_PRECOMPILED_HEADER)
+
+
+# Generates the use of precompiled in a target,
+# without using depency targets (2 extra for each target)
+# Using Visual, must also add ${_targetName}_pch to sources
+# Not needed by Xcode
+
+MACRO(GET_NATIVE_PRECOMPILED_HEADER _targetName _input)
+
+       if(CMAKE_GENERATOR MATCHES Visual*)
+
+               SET(_dummy_str "#include \"${_input}\"\n"
+                                                                               "// This is required to suppress LNK4221.  Very annoying.\n"
+                                                                               "void *g_${_targetName}Dummy = 0\;\n")
+
+               # Use of cxx extension for generated files (as Qt does)
+               SET(${_targetName}_pch ${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch.cxx)
+               if(EXISTS ${${_targetName}_pch})
+                       # Check if contents is the same, if not rewrite
+                       # todo
+               else(EXISTS ${${_targetName}_pch})
+                       FILE(WRITE ${${_targetName}_pch} ${_dummy_str})
+               endif(EXISTS ${${_targetName}_pch})
+       endif(CMAKE_GENERATOR MATCHES Visual*)
+
+ENDMACRO(GET_NATIVE_PRECOMPILED_HEADER)
+
+
+MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _input)
+
+       IF( "${ARGN}" STREQUAL "0")
+               SET(_dowarn 0)
+       ELSE( "${ARGN}" STREQUAL "0")
+               SET(_dowarn 1)
+       ENDIF("${ARGN}" STREQUAL "0")
+       
+       if(CMAKE_GENERATOR MATCHES Visual*)
+               # Auto include the precompile (useful for moc processing, since the use of 
+               # precompiled is specified at the target level
+               # and I don't want to specifiy /F- for each moc/res/ui generated files (using Qt)
+
+               GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
+               if (${oldProps} MATCHES NOTFOUND)
+                       SET(oldProps "")
+               endif(${oldProps} MATCHES NOTFOUND)
+
+               SET(newProperties "${oldProps} /Yu\"${_input}\" /FI\"${_input}\"")
+               SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}")
+               
+               #also inlude ${oldProps} to have the same compile options 
+               SET_SOURCE_FILES_PROPERTIES(${${_targetName}_pch} PROPERTIES COMPILE_FLAGS "${oldProps} /Yc\"${_input}\"")
+               
+       else(CMAKE_GENERATOR MATCHES Visual*)
+       
+               if (CMAKE_GENERATOR MATCHES Xcode)
+                       # For Xcode, cmake needs my patch to process
+                       # GCC_PREFIX_HEADER and GCC_PRECOMPILE_PREFIX_HEADER as target properties
+                       
+                       GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
+                       if (${oldProps} MATCHES NOTFOUND)
+                               SET(oldProps "")
+                       endif(${oldProps} MATCHES NOTFOUND)
+
+                       # When buiding out of the tree, precompiled may not be located
+                       # Use full path instead.
+                       GET_FILENAME_COMPONENT(fullPath ${_input} ABSOLUTE)
+
+                       SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${fullPath}")
+                       SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES")
+
+               else (CMAKE_GENERATOR MATCHES Xcode)
+
+                       #Fallback to the "old" precompiled suppport
+                       #ADD_PRECOMPILED_HEADER(${_targetName} ${_input} ${_dowarn})
+               endif(CMAKE_GENERATOR MATCHES Xcode)
+       endif(CMAKE_GENERATOR MATCHES Visual*)
+
+ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER)
index dae16a14e7bc20cb8254190152c2e3df3ac87d5c..ba6cad796e0be47efd1c4c8be659ab8a8434d6ac 100644 (file)
@@ -67,5 +67,5 @@
 
 #if defined(LYX_PCH_QT4) && defined(LYX_BUILD_QT4_FRONTEND)
 #include <QtCore>
-#include <QtGUI>
+#include <QtGui>
 #endif
index 1535328ec2b2bc821f327d51f23fb511a4bbd5a3..a803e769956f825acdca58955c6e1ae249511b01 100644 (file)
@@ -71,6 +71,8 @@ add_executable(${_lyx}
        ${vld_files}
 )
 
+lyx_add_gcc_pch(lyx)
+
 target_link_libraries(${_lyx}
        mathed
        insets
index a263e2ba384f79441431b3c9ff01be661f7651e9..cea656cce3e65f9e3282cda2d932dcc329a3214a 100644 (file)
@@ -25,5 +25,7 @@ endif()
 
 target_link_libraries(frontends ${Lyx_Boost_Libraries})
 
+lyx_add_gcc_pch(frontends)
+
 project_source_group("${GROUP_CODE}" frontends_sources frontends_headers)
 
index 26075319dee2af09c0dceab73c40745a6941db64..553080d99b082a744e49d6cda15786c0b6dcbb9e 100644 (file)
@@ -52,6 +52,8 @@ target_link_libraries(frontend_qt4
        ${QT_QTCORE_LIBRARY}
        ${QT_QTGUI_LIBRARY})
 
+lyx_add_gcc_pch(frontend_qt4)
+
 if(WIN32)
        target_link_libraries(frontend_qt4 Gdi32)
 endif()
index e3855ad8dbb72a8a62da297dc21252b889b52b2e..f45e639599f58ce0ff20546baf8ed329ea4dfc3f 100644 (file)
@@ -21,5 +21,7 @@ else()
        add_library(graphics ${library_type} ${_allinone_files})
 endif()
 
+lyx_add_gcc_pch(graphics)
+
 project_source_group("${GROUP_CODE}" graphics_sources graphics_headers)
 
index 380eebf68a302d252d847d033aa5d6f17eb1f417..89f84fd9a9d45cbcee0e7beb7fef63655054d670 100644 (file)
@@ -23,6 +23,7 @@ else()
        add_library(insets ${library_type} ${_allinone_files})
 endif()
 
+lyx_add_gcc_pch(insets)
 
 project_source_group("${GROUP_CODE}" insets_sources insets_headers)
 
index 654346a29081aaf528e4424c88e6484971060f0d..16d8a64c3689ebce4ace9d22ed1cb5d82066df85 100644 (file)
@@ -24,5 +24,7 @@ else()
        add_library(mathed ${library_type} ${_allinone_files})
 endif()
 
+lyx_add_gcc_pch(mathed)
+
 project_source_group("${GROUP_CODE}" mathed_sources mathed_headers)
 
index 92af3dee7fbcda73eba654d67d60cfae043525f9..cb46426ee719ce8f4c4e87f7e1c9e759a9663031 100644 (file)
@@ -63,6 +63,8 @@ endif()
 
 target_link_libraries(support ${Lyx_Boost_Libraries} ${QT_QTCORE_LIBRARY} ${ZLIB_LIBRARY})
 
+lyx_add_gcc_pch(support)
+
 if(APPLE)
        target_link_libraries(support "objc" "-framework Appkit" "-framework CoreFoundation")
 elseif(WIN32)