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

Peter Kümmel syntheticpp at gmx.net
Tue Mar 22 22:59:48 CET 2011


SVN commit 1225674 by kuemmel:

make it possible to install kst1 and kst2 in /usr/lib. so we use everywhere 'kst2'.
sorry, with this change the cmake code has become much more cryptic...

 M  +11 -9     modules/KstMacros.cmake  
 M  +2 -2      src/d2asc/CMakeLists.txt  
 M  +3 -3      src/d2d/CMakeLists.txt  
 M  +3 -3      src/kst/CMakeLists.txt  
 M  +1 -1      src/libkst/CMakeLists.txt  
 M  +3 -3      src/libkstapp/CMakeLists.txt  
 M  +3 -3      src/libkstmath/CMakeLists.txt  
 M  +3 -3      src/widgets/CMakeLists.txt  
 M  +3 -3      tests/CMakeLists.txt  
 M  +3 -3      tests/allinone/CMakeLists.txt  


--- branches/work/kst/portto4/kst/cmake/modules/KstMacros.cmake #1225673:1225674
@@ -9,8 +9,9 @@
 endmacro()
 
 
-macro(kst_init name)
-	set(kst_name ${name})
+macro(kst_init prefix name_base)
+	set(kst_name ${prefix}${name_base})
+	set(kst_name_base ${name_base})
 	set(kst_${kst_name}_dont_merge)
 	set(kst_${kst_name}_ignore)
 	set(kst_${kst_name}_info_files)
@@ -86,10 +87,10 @@
 	set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${kst_build_dir}/bin)
 	set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${kst_build_dir}/${kst_install_libdir})
 	include_directories(${kst_${kst_name}_folder} ${CMAKE_CURRENT_BINARY_DIR})
-	string(TOUPPER BUILD_${kst_name} _build_macro)
+	string(TOUPPER BUILD_kst${kst_name_base} _build_macro)
 	add_definitions(-D${_build_macro})
 	if(kst_pch)
-		set(pch ${kst_name}_pch)
+		set(pch kst${kst_name_base}_pch)
 		configure_file(${kst_${kst_name}_folder}/${pch} ${CMAKE_CURRENT_BINARY_DIR}/${pch}.h COPYONLY)
 		#add_definitions(-DKST_PCH_RECURSIVE) # only some percents faster
 		kst_add_pch_rule(${CMAKE_CURRENT_BINARY_DIR}/${pch}.h kst_${kst_name}_sources ${type})
@@ -115,6 +116,7 @@
 		add_library(${kst_name} ${type} ${kst_${kst_name}_sources} ${kst_${kst_name}_headers} ${svnversion_h})
 		kst_flat_source_group(${kst_${kst_name}_headers} ${kst_${kst_name}_sources_not_generated})
 	endif()
+	set(lib${kst_name_base} ${kst_name} CACHE STRING "actual ${kst_name} name" FORCE)
 	set_property(TARGET ${kst_name} PROPERTY DEBUG_POSTFIX ${kst_debug_postfix})
 	set_target_properties(${kst_name} PROPERTIES VERSION ${kst_version} SOVERSION ${kst_version_major})
 	kst_revision_add_dependency()
@@ -136,22 +138,22 @@
 		set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${kst_build_dir}/${kst_install_plugins})
 	endif()
 	include_directories(${CMAKE_BINARY_DIR}/${dir})
-	kst_include_directories(kstcore kstmath kstwidgets)
+	kst_include_directories(core math widgets)
 	set(kst_plugin_dir ${dir})
 	set(kst_plugin_prefix ${ARGN})
 endmacro()
 
 
 macro(kst_add_plugin folder name)
-	set(_name kst_${kst_plugin_prefix}_${folder}_${name})
+	set(_name _${kst_plugin_prefix}_${folder}_${name})
 	string(REPLACE . _  _name ${_name})
 	string(REPLACE / _  _name ${_name})
 	string(REPLACE __ _ _name ${_name})
 	string(REPLACE __ _ _name ${_name})
-	kst_init(${_name})
+	kst_init(${kst_binary_name} ${_name})
 	kst_files_find(${kst_plugin_dir}/${folder}/${name})
 	add_library(${kst_name} MODULE ${kst_${kst_name}_sources} ${kst_${kst_name}_headers})
-	kst_link(kstcore kstmath kstwidgets)
+	kst_link(${libcore} ${libmath} ${libwidgets})
 	if(NOT APPLE)
 		install(TARGETS ${kst_name} LIBRARY DESTINATION ${kst_install_plugins})
 		kst_find_install_desktop_file(${kst_plugin_dir}/${folder}/${name})
@@ -166,7 +168,7 @@
 
 macro(kst_include_directories)
 	foreach(_it ${ARGV})
-		include_directories(${kst_${_it}_includes})
+		include_directories(${kst_${kst_binary_name}${_it}_includes})
 	endforeach()
 endmacro()
 
--- branches/work/kst/portto4/kst/cmake/src/d2asc/CMakeLists.txt #1225673:1225674
@@ -2,11 +2,11 @@
 
 kst_files_find(src/d2asc)
 
-kst_include_directories(kstcore kstmath)
+kst_include_directories(core math)
 
 kst_add_executable()
 
-kst_link(kstcore kstmath)
+kst_link(${libcore} ${libmath})
 
 kst_install_executable()
 
--- branches/work/kst/portto4/kst/cmake/src/d2d/CMakeLists.txt #1225673:1225674
@@ -1,11 +1,11 @@
-kst_init(d2d)
+kst_init(d2d "")
 
 kst_files_find(src/d2d)
 
-kst_include_directories(kstcore kstmath)
+kst_include_directories(core math)
 
 kst_add_executable()
 
-kst_link(kstcore kstmath)
+kst_link(${libcore} ${libmath})
 
 kst_install_executable()
--- branches/work/kst/portto4/kst/cmake/src/kst/CMakeLists.txt #1225673:1225674
@@ -1,4 +1,4 @@
-kst_init(${kst_binary_name})
+kst_init(${kst_binary_name} "")
 
 kst_files_ignore(main-vld)
 
@@ -26,11 +26,11 @@
 	${kst_dir}/NEWS
 	${kst_dir}/README)
 
-kst_include_directories(kstapp)
+kst_include_directories(app)
 
 kst_add_executable(${kst_win32} ${rc_file})
 
-kst_link(kstcore kstmath kstapp kstwidgets)
+kst_link(${libcore} ${libmath} ${libapp} ${libwidgets})
 
 kst_install_executable()
 
--- branches/work/kst/portto4/kst/cmake/src/libkst/CMakeLists.txt #1225673:1225674
@@ -1,4 +1,4 @@
-kst_init(kstcore)
+kst_init(${kst_binary_name} core)
 
 kst_files_ignore(stdinsource timezones)
 
--- branches/work/kst/portto4/kst/cmake/src/libkstapp/CMakeLists.txt #1225673:1225674
@@ -1,8 +1,8 @@
-kst_init(kstapp)
+kst_init(${kst_binary_name} app)
 
 kst_files_find(src/libkstapp)
 
-kst_include_directories(kstcore kstmath kstwidgets)
+kst_include_directories(core math widgets)
 
 set(AUTHORS ${kst_dir}/AUTHORS)
 set_source_files_properties(${AUTHORS} PROPERTIES GENERATED TRUE HEADER_FILE_ONLY TRUE)
@@ -16,4 +16,4 @@
 		
 kst_add_library(STATIC ${CMAKE_BINARY_DIR}/authors.h ${AUTHORS})
 
-kst_link(kstcore kstmath kstwidgets)
+kst_link(${libcore} ${libmath} ${libwidgets})
--- branches/work/kst/portto4/kst/cmake/src/libkstmath/CMakeLists.txt #1225673:1225674
@@ -1,11 +1,11 @@
-kst_init(kstmath)
+kst_init(${kst_binary_name} math)
 
 kst_files_find(src/libkstmath)
 
 kst_dont_merge(eparse.cpp escan.cpp fftsg_h.c)
 
-kst_include_directories(kstcore)
+kst_include_directories(core math)
 
 kst_add_library(SHARED)
 
-kst_link(kstcore)
\ No newline at end of file
+kst_link(${libcore})
\ No newline at end of file
--- branches/work/kst/portto4/kst/cmake/src/widgets/CMakeLists.txt #1225673:1225674
@@ -1,9 +1,9 @@
-kst_init(kstwidgets)
+kst_init(${kst_binary_name} widgets)
 
 kst_files_find(src/widgets)
 
-kst_include_directories(kstcore kstapp kstmath)
+kst_include_directories(core app math)
 
 kst_add_library(SHARED)
 
-kst_link(kstcore kstmath)
\ No newline at end of file
+kst_link(${libcore} ${libmath})
\ No newline at end of file
--- branches/work/kst/portto4/kst/cmake/tests/CMakeLists.txt #1225673:1225674
@@ -4,7 +4,7 @@
 
 list(REMOVE_ITEM test_headers ${kst_dir}/tests/ksttest.h)
 
-kst_include_directories(kstcore kstmath)
+kst_include_directories(core math)
 
 add_definitions(-DKST_USE_QTEST_MAIN -DKST_SRC_DIR=${kst_dir})
 
@@ -16,7 +16,7 @@
 		message(STATUS "Building test ${testname}")
 	endif()
 
-	kst_init(${testname})
+	kst_init(${testname} "")
 
 	set(moc_file)
 	qt4_wrap_cpp(moc_file ${header} OPTIONS "-nw")
@@ -26,7 +26,7 @@
 		${kst_dir}/tests/${filename}.cpp
 		${header} ${moc_file})
 
-	kst_link(kstcore kstmath ${QT_QTTEST_LIBRARY})
+	kst_link(${libcore} ${libmath} ${QT_QTTEST_LIBRARY})
 
 	add_test(NAME ${testname} COMMAND ${testname})
 
--- branches/work/kst/portto4/kst/cmake/tests/allinone/CMakeLists.txt #1225673:1225674
@@ -1,13 +1,13 @@
 
-kst_init(ksttests)
+kst_init(${kst_binary_name} tests)
 
 kst_files_find(tests)
 
-kst_include_directories(kstcore kstmath)
+kst_include_directories(core math)
 
 remove_definitions(-DKST_USE_QTEST_MAIN)
 
 kst_add_executable()
 
-kst_link(kstcore kstmath ${QT_QTTEST_LIBRARY})
+kst_link(${libcore} ${libmath} ${QT_QTTEST_LIBRARY})
 


More information about the Kst mailing list