From: Rolf Eike Beer Date: Fri, 1 Jul 2016 16:47:06 +0000 (+0200) Subject: Simplify CMake code X-Git-Tag: 0.12.5~80 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=8bf4155c52557a43571b5d82dcd710e63165fb04;hp=69c491ea2b2542eeb1cd977db1b59ea206e1509a Simplify CMake code (cherry picked from commit 8cacd45fd61aeaa5a50ed9985577022cae00fcff) --- diff --git a/CMakeLists.txt b/CMakeLists.txt index a2ebc195..168162bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,7 +83,7 @@ option(WITH_WEBENGINE "WebEngine support (for link previews)" ON) if (APPLE) # Notification Center is only available in > 10.8, which is Darwin v12 - if (CMAKE_SYSTEM_VERSION VERSION_GREATER "11.9.9") + if (NOT CMAKE_SYSTEM_VERSION VERSION_LESS 12) option(WITH_NOTIFICATION_CENTER "OS X Notification Center support" ON) add_feature_info(WITH_NOTIFICATION_CENTER WITH_NOTIFICATION_CENTER "Use the OS X Notification Center") endif() @@ -154,22 +154,6 @@ endif() # Set up Qt ##################################################################### -if (USE_QT5) - message(STATUS "Building for Qt5...") - set(QT_MIN_VERSION "5.2.0") - add_definitions(-DHAVE_QT5) -else() - message(STATUS "Building for Qt4...") - set(QT_MIN_VERSION "4.8.0") - - # Select a Qt installation here, if you don't want to use system Qt - if(QT_PATH) - # FindQt4 will look for the qmake binary in $PATH, so we just prepend QT_PATH - set(ENV{PATH} ${QT_PATH}/bin:$ENV{PATH}) - endif() -endif() - - # Find package dependencies # # Note that you can forcefully disable optional packages @@ -177,6 +161,10 @@ endif() ##################################################################### if (USE_QT5) + message(STATUS "Building for Qt5...") + set(QT_MIN_VERSION "5.2.0") + add_definitions(-DHAVE_QT5) + find_package(Qt5Core ${QT_MIN_VERSION} QUIET) set_package_properties(Qt5Core PROPERTIES TYPE REQUIRED URL "http://qt.digia.com" @@ -366,6 +354,15 @@ if (USE_QT5) endif() else(USE_QT5) + message(STATUS "Building for Qt4...") + set(QT_MIN_VERSION "4.8.0") + + # Select a Qt installation here, if you don't want to use system Qt + if(QT_PATH) + # FindQt4 will look for the qmake binary in $PATH, so we just prepend QT_PATH + set(ENV{PATH} ${QT_PATH}/bin:$ENV{PATH}) + endif() + find_package(Qt4 ${QT_MIN_VERSION} QUIET REQUIRED) if (BUILD_GUI)