Author: Andreas Tille 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 +