On Thu, Aug 6, 2009 at 2:34 PM, ML<mailingli...@mailnewsrss.com> wrote: > Hi All, > > Can CMAKE use Pre-compiled headers now? I thought that I recalled their > being an issue at some point, not sure. > > Can anyone shed some light? >
I do this for my Visual Studio builds with a macro. ######################################################################################### macro( LA_PCH_SUPPORT ProjectName ) if (MSVC) if (USE_MSVC_PCH) set_source_files_properties(${ProjectName}PCH.cxx PROPERTIES COMPILE_FLAGS "/Yc${ProjectName}PCH.h" ) foreach( src_file ${${ProjectName}_SRCS} ) set_source_files_properties( ${src_file} PROPERTIES COMPILE_FLAGS "/Yu${ProjectName}PCH.h" ) endforeach( src_file ${${ProjectName}_SRCS} ) list(APPEND ${ProjectName}_SRCS ${ProjectName}PCH.cxx) list(APPEND ${ProjectName}_EXT_HDRS ${ProjectName}PCH.h) endif(USE_MSVC_PCH) endif (MSVC) endmacro (LA_PCH_SUPPORT) Then its usage in a project named laGUI SET( laGUI_SRCS ./src/laMultiViewFrameMgr.cxx ./src/VTK2dWidget.cpp ./src/laCentralWidget.cxx ./src/laImageSliceView.cxx ./src/laWLWidget.cxx ./src/laTableWidget.cxx ./src/laPipelineWidget.cxx ./src/ImageSliceViewer.cxx ./src/InteractorObserver.cxx ./src/laVTKInteractorStyleImage2D.cxx ./src/laVTKCommandImage2D.cxx ./src/la2DView.cxx ./src/la3DView.cxx ) SET( laGUI_EXT_HDRS ./Include/InteractorObserver.h ./Include/laVTKInteractorStyleImage2D.h ./Include/laVTKCommandImage2D.h ) SET( laGUI_MOC_HDRS ./Include/ImageSliceViewer.h ./Include/laMultiViewFrameMgr.h ./Include/VTK2dWidget.h ./Include/laCentralWidget.h ./Include/laImageSliceView.h ./Include/laWLWidget.h ./Include/laTableWidget.h ./Include/laPipelineWidget.h ./Include/la2DView.h ./Include/la3DView.h ) #Add precompiled header support LA_PCH_SUPPORT(laGUI) Then externally create laGUIPCH.cxx laGUIPCH.h in the same folder as the CMakeLists.txt file for the project. John _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake