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