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

Peter Kümmel syntheticpp at gmx.net
Mon Aug 27 11:42:36 UTC 2012


SVN commit 1313580 by kuemmel:

build on Linux with Qt5

 M  +10 -5     CMakeLists.txt  
 M  +3 -1      modules/KstPchSupport.cmake  
 M  +3 -0      src/libkstapp/CMakeLists.txt  


--- branches/work/kst/portto4/kst/cmake/CMakeLists.txt #1313579:1313580
@@ -127,11 +127,16 @@
 # Find 3rd party libraries
 if (kst_qt5)
 	# http://doc-snapshot.qt-project.org/5.0/cmake-manual.html
+	cmake_minimum_required(VERSION 2.8.9)
 	set(CMAKE_PREFIX_PATH ${kst_qt5})
-	find_package(Qt5Widgets REQUIRED)
-	find_package(Qt5Network REQUIRED)
-	find_package(Qt5Xml REQUIRED)
-	find_package(Qt5OpenGL REQUIRED)
+	macro(use_qt5lib qt5lib)
+		find_package(${qt5lib} REQUIRED)
+		include_directories(${${qt5lib}_INCLUDE_DIRS})
+	endmacro()
+	use_qt5lib(Qt5Widgets)
+	use_qt5lib(Qt5Network)
+	use_qt5lib(Qt5Xml)
+	use_qt5lib(Qt5OpenGL)
 	add_definitions(-DQT5=1)
 else()
 	find_package(Qt4 REQUIRED)
@@ -201,7 +206,7 @@
 
 if(NOT kst_console)
 	set(kst_win32 WIN32)
-	if(kst_qt5)
+	if(kst_qt5 AND WIN32)
 		set(kst_qtmain_library Qt5::WinMain)
 	else()
 		set(kst_qtmain_library ${QT_QTMAIN_LIBRARY})
--- branches/work/kst/portto4/kst/cmake/modules/KstPchSupport.cmake #1313579:1313580
@@ -41,13 +41,15 @@
 		if(${_lib_type} MATCHES SHARED)
 			list(APPEND _args ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
 		endif()
+		if(_definitions_type)
 		list(APPEND _args -D${_definitions_type})
+		endif()
 		#message(STATUS "pch: ${_args}")
 		
 		get_directory_property(DIRINC INCLUDE_DIRECTORIES)
 		foreach (_inc ${DIRINC})
 			LIST(APPEND _args "-I" ${_inc})
-		endforeach(_inc ${DIRINC})
+		endforeach()
 		
 		set(_gch_filename "${_header}.gch")
 		list(APPEND ${_sources} ${_gch_filename})
--- branches/work/kst/portto4/kst/cmake/src/libkstapp/CMakeLists.txt #1313579:1313580
@@ -3,7 +3,10 @@
 if(kst_qt5 AND kst_qt5base_only)
     kst_files_ignore(svgitem)
     add_definitions(-DKST_NO_PRINTER -DKST_NO_SVG)
+	if(UNIX)
+		set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
 endif()
+endif()
 
 kst_files_find(src/libkstapp)
 


More information about the Kst mailing list