1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
Author: Andreas Tille <tille@debian.org>
Last-Update: 2017-11-17
Description: Try to upgrade from Qt4 to Qt5
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,14 +1,22 @@
-# this command finds Qt4 libraries and sets all required variables
-# note that it's Qt4, not QT4 or qt4
-#/usr/share/cmake-2.6/Modules/FindQt4.cmake
SET (QT_USE_QTXML true)
-FIND_PACKAGE( Qt4 REQUIRED )
-INCLUDE( ${QT_USE_FILE} )
+# Find includes in corresponding build directories
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
-#FIND_PACKAGE(X11 REQUIRED)
-#FIND_PACKAGE(FindThreads REQUIRED)
+# Find the Qt5 libraries
+find_package(Qt5Widgets)
+find_package(Qt5Core)
+
+# Add the include directories for the Qt 5 Widgets module to
+# the compile lines.
+include_directories(${Qt5Widgets_INCLUDE_DIRS})
+
+# Use the compile definitions defined in the Qt 5 Widgets module
+add_definitions(${Qt5Widgets_DEFINITIONS})
+
+# Add compiler flags for building executables (-fPIE)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS} -fPIC")
IF(WIN32)
ADD_DEFINITIONS(-DMINGW32)
@@ -34,7 +42,7 @@ arbre.cpp arbreplus.cpp couleur.cpp vect
IF(WIN32)
target_link_libraries (populations ${QT_LIBRARIES})
ELSE(WIN32)
- target_link_libraries (populations ${QT_LIBRARIES} m)
+ target_link_libraries (populations Qt5::Widgets Qt5::Core m)
ENDIF(WIN32)
-
\ No newline at end of file
+
|