commit e264b69cfbeea96df0bd4467e9757e273de68f79
Author: Kornel Benko <kor...@lyx.org>
Date:   Mon Jun 9 10:08:32 2014 +0200

    Cmake build: Use LYX_COMBO() to select the qt-version to use.
    
    Collaboration with Scott Kostyshak

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9fdc289..3bc9228 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -140,7 +140,11 @@ LYX_OPTION(DEPENDENCIES_DOWNLOAD "Download dependencies 
for MSVC 10" OFF MSVC)
 # APPLE specific
 LYX_OPTION(DMG                   "Build as Mac bundle, needed for .dmg  
(experimental) " OFF MAC)
 LYX_OPTION(COCOA                 "Use Cocoa on Mac" OFF MAC)
-LYX_COMBO(USE_QT                 "Use Qt version as frontend (QT4 QT5)" QT4 
QT5)
+if(LYX_XMINGW)
+  LYX_COMBO(USE_QT               "Use Qt version as frontend for MINGW" QT4)
+else()
+  LYX_COMBO(USE_QT               "Use Qt version as frontend" QT4 QT5)
+endif()
 
 
 if(help OR HELP)
@@ -536,10 +540,10 @@ endif()
 if(LYX_XMINGW)
     set(QT_MINGW_DIR ${LYX_QT4} CACHE PATH "Qt for Mingw" FORCE)
     list(APPEND CMAKE_FIND_ROOT_PATH ${QT_MINGW_DIR} ${GNUWIN32_DIR})
-else()
-    find_package(Qt5Core QUIET)
 endif()
-if (Qt5Core_FOUND)
+if(LYX_USE_QT MATCHES "QT5")
+  find_package(Qt5Core REQUIRED)
+  if (Qt5Core_FOUND)
        find_package(Qt5Widgets REQUIRED)
         find_package(Qt5X11Extras)
        set(QTVERSION ${Qt5Core_VERSION})
@@ -552,7 +556,8 @@ if (Qt5Core_FOUND)
        macro (qt_wrap_uifiles)
                qt5_wrap_ui(${ARGN})
        endmacro()
-else()
+  endif()
+elseif(LYX_USE_QT MATCHES "QT4")
        find_package(Qt4 "4.5.0" REQUIRED)
        macro (qt_use_modules)
        endmacro()
@@ -562,6 +567,8 @@ else()
        macro (qt_wrap_uifiles)
                qt4_wrap_ui(${ARGN})
        endmacro()
+else()
+  message(FATAL_ERROR "Unhandled value for LYX_USE_QT (${LYX_USE_QT})")
 endif()
 
 find_package(Magic)

Reply via email to