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

Peter Kümmel syntheticpp at gmx.net
Wed Jan 26 10:23:49 CET 2011


SVN commit 1217180 by kuemmel:

cmake: option to suppress svnversion so it doesn't rebuild after each commit

 M  +1 -0      INSTALL  
 M  +11 -5     cmake/CMakeLists.txt  
 M  +9 -2      cmake/modules/KstMacros.cmake  


--- branches/work/kst/portto4/kst/INSTALL #1217179:1217180
@@ -113,6 +113,7 @@
 	-- kst_test                 = OFF    : Build unit tests
 	-- kst_pch                  = OFF    : Use precompiled headers
 	-- kst_edit_cont            = OFF    : Enable "Edit and Continue" for Visual Studio
+	-- kst_svnversion           = OFF    : Use svnversion's output for Kst's version information
 
 	
 	To enable a option pass the value ON or 1, eg
--- branches/work/kst/portto4/kst/cmake/CMakeLists.txt #1217179:1217180
@@ -12,11 +12,6 @@
 set(kst_version_patch 3)
 set(kst_version ${kst_version_major}.${kst_version_minor}.${kst_version_patch})
 
-include(SubversionHeader)
-kst_revision_project_name(Revision)
-add_definitions(-DKST_HAVE_SVN_REVISION_H)
-SubversionHeader(${kst_dir} ${kst_revision_project} ${CMAKE_BINARY_DIR}/svnrevision.h _modified)
-
 set(kst_binary_name kst)
 
 
@@ -32,10 +27,21 @@
 kst_option(test "Build unit tests" OFF all)
 kst_option(pch "Use precompiled headers" ON all)
 kst_option(edit_cont "Enable \"Edit and Continue\" for Visual Studio" OFF win)
+kst_option(svnversion "Use svnversion's output for Kst's version information" ON all)
 
 
 message(STATUS)
 
+kst_revision_project_name(Revision)
+add_definitions(-DKST_HAVE_SVN_REVISION_H)
+if(kst_svnversion)
+	include(SubversionHeader)
+	SubversionHeader(${kst_dir} ${kst_revision_project} ${CMAKE_BINARY_DIR}/svnrevision.h _modified)
+else()
+	file(WRITE ${CMAKE_BINARY_DIR}/svnrevision.h.tmp "#define SVN_REVISION \"unknown\"\n")
+	configure_file(${CMAKE_BINARY_DIR}/svnrevision.h.tmp ${CMAKE_BINARY_DIR}/svnrevision.h COPYONLY)
+endif()
+
 # Find 3rd party libraries
 find_package(Qt4 REQUIRED)
 include(${QT_USE_FILE})
--- branches/work/kst/portto4/kst/cmake/modules/KstMacros.cmake #1217179:1217180
@@ -22,6 +22,13 @@
 endmacro()
 
 
+macro(kst_revision_add_dependency)
+	if(kst_revision_project)
+		add_dependencies(${kst_name} ${kst_revision_project})
+	endif()
+endmacro()
+
+
 macro(kst_files_find folder)
 	set(_folder ${kst_dir}/${folder})
 	file(GLOB _sources     ${_folder}/*.c) 
@@ -67,7 +74,7 @@
 	add_executable(${kst_name} ${ARGN} ${kst_${kst_name}_sources} ${kst_${kst_name}_headers} ${kst_${kst_name}_info_files})
 	target_link_libraries(${kst_name} ${kst_qtmain_library})
 	kst_set_target_properties()
-	add_dependencies(${kst_name} ${kst_revision_project})
+	kst_revision_add_dependency()
 	kst_flat_source_group(${kst_${kst_name}_headers} ${kst_${kst_name}_sources_not_generated})
 endmacro()
 
@@ -113,7 +120,7 @@
 	endif()
 	kst_set_target_properties()
 	kst_flat_source_group(${kst_${kst_name}_headers} ${kst_${kst_name}_sources_not_generated})
-	add_dependencies(${kst_name} ${kst_revision_project})
+	kst_revision_add_dependency()
 	if(WIN32)
 		install(TARGETS ${kst_name} RUNTIME DESTINATION bin
 		                            ARCHIVE DESTINATION lib)


More information about the Kst mailing list