[Kst] branches/work/kst/portto4/kst/cmake

Peter Kümmel syntheticpp at gmx.net
Sun Jan 16 20:25:02 CET 2011


SVN commit 1214884 by kuemmel:

cmake: add precomiled headers, should be more comfortable 
when heavily working on several times and much recompiling 
is required. For a simple complete build merged files
build is still twice as fast (4 cores & HT):
        -j8   -j1
merged:  1    1.9
pch   : 1.9   6.4
plain : 2.2   8.1


 M  +7 -0      CMakeLists.txt  
 M  +7 -0      modules/KstMacros.cmake  
 AM            modules/KstPchSupport.cmake  


--- branches/work/kst/portto4/kst/cmake/CMakeLists.txt #1214883:1214884
@@ -28,6 +28,7 @@
 kst_option(3rdparty "Build plugins depending on 3rd party libraries" ON all)
 kst_option(dataobjects "Build dataobject plugins" ON all)
 kst_option(test "Build unit tests" OFF all)
+kst_option(pch "Use precompiled headers" OFF all)
 
 
 
@@ -94,7 +95,13 @@
 	set(kst_win32 MACOSX_BUNDLE)
 endif()
 
+if(kst_pch)
+	set(kst_merge_files CACHE STRING "merge files disabled because of using pchs" FORCE)
+endif()
 
+
+
+
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR}/bin)
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR}/lib) 
 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR}/lib) 
--- branches/work/kst/portto4/kst/cmake/modules/KstMacros.cmake #1214883:1214884
@@ -1,4 +1,5 @@
 include(MergedFilesBuild)
+include(KstPchSupport)
 
 
 macro(kst_init name)
@@ -81,6 +82,12 @@
 	include_directories(${kst_${kst_name}_folder} ${CMAKE_CURRENT_BINARY_DIR})
 	string(TOUPPER BUILD_${kst_name} _build_macro)
 	add_definitions(-D${_build_macro})
+	if(kst_pch)
+		# TODO each lib could use its own pch header
+		set(pch ${CMAKE_CURRENT_BINARY_DIR}/pch.h)
+		configure_file(${kst_dir}/pch.h ${pch})
+		kst_add_pch_rule(${pch} kst_${kst_name}_sources ${type})
+	endif()
 	if(kst_merge_files)
 		if(kst_merge_rebuild)
 			set(merged_files_rebuild 1)


More information about the Kst mailing list