1 From 7288382029f30b5e6ba7ac91b3b2e5d7f96d239a Mon Sep 17 00:00:00 2001
2 From: Andreas Sturmlechner <andreas.sturmlechner@gmail.com>
3 Date: Sun, 9 Apr 2017 18:41:15 +0200
4 Subject: [PATCH 2/2] Use FeatureSummary and simplify by requiring Qt-4.8
7 CMakeLists.txt | 26 ++++++++++----------------
8 1 file changed, 10 insertions(+), 16 deletions(-)
10 diff --git a/CMakeLists.txt b/CMakeLists.txt
11 index d0c44bb..5f1305e 100755
14 @@ -12,6 +12,7 @@ if(POLICY CMP0020)
17 include(GNUInstallDirs)
18 +include(FeatureSummary)
20 set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_LIBDIR})
22 @@ -42,14 +43,14 @@ SET(FRAMEWORK_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/Library/Frameworks"
23 # (This will have no effect with CMake < 2.8)
24 SET(QT_USE_IMPORTED_TARGETS TRUE)
26 -option(QT4_BUILD "Force building with Qt4 even if Qt5 is found")
27 +option(QT4_BUILD "Force building with Qt4 even if Qt5 is found" OFF)
29 - FIND_PACKAGE( Qt5Core QUIET )
30 + FIND_PACKAGE( Qt5Core )
32 + MESSAGE ("Forced build with Qt4")
36 - MESSAGE ("Qt5 found")
38 INCLUDE_DIRECTORIES(${Qt5Core_INCLUDE_DIRS})
39 ADD_DEFINITIONS(${Qt5Core_DEFINITIONS})
40 SET(PC_Requires "Qt5Core")
41 @@ -59,20 +60,11 @@ IF (Qt5Core_FOUND)
42 # As moc files are generated in the binary dir, tell CMake
43 # to always look for includes there:
44 set(CMAKE_INCLUDE_CURRENT_DIR ON)
45 - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_USE_QSTRINGBUILDER" )
46 - MESSAGE ("Enable QStringBuilder")
47 + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_USE_QSTRINGBUILDER" )
49 - MESSAGE ("Qt5 not found, searching for Qt4")
51 - FIND_PACKAGE( Qt4 4.5 REQUIRED )
52 - # QStringBuilder is supported since Qt 4.8 for both QString and QByteArray
53 - IF (NOT (${QT_VERSION_MINOR} STRLESS "8"))
54 - MESSAGE ("Enable QStringBuilder")
55 - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_USE_QSTRINGBUILDER" )
57 - MESSAGE ("Disable QStringBuilder")
60 + FIND_PACKAGE( Qt4 4.8 REQUIRED QtCore)
61 + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_USE_QSTRINGBUILDER" )
62 # Include the cmake file needed to use qt4
63 INCLUDE( ${QT_USE_FILE} )
64 SET(PC_Requires "QtCore")
65 @@ -131,3 +123,5 @@ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/QJSON${QJSON_SUFFIX}Config.cmake
67 ADD_CUSTOM_TARGET(uninstall
68 "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
70 +FEATURE_SUMMARY(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)