]> git.mxchange.org Git - flightgear.git/commitdiff
- Make Qt check guarded by a CMake option
authorJames Turner <zakalawe@mac.com>
Sat, 10 Jan 2015 14:05:23 +0000 (14:05 +0000)
committerJames Turner <zakalawe@mac.com>
Sat, 10 Jan 2015 14:05:23 +0000 (14:05 +0000)
- Only init QApplication if showing the launcher.

CMakeLists.txt
src/Main/main.cxx

index 92f9c7b67051e705515d6543f5b9000c9e676085..5b161e6468f26fc48e12503b55e2330f519d6282 100644 (file)
@@ -170,6 +170,7 @@ option(ENABLE_METAR      "Set to ON to build the metar application (default)" ON
 option(ENABLE_TESTS      "Set to ON to build test applications (default)" ON)
 option(ENABLE_FGCOM      "Set to ON to build the FGCom application (default)" ON)
 option(ENABLE_FLITE      "Set to ON to build the Flite text-to-speech module" ON)
+option(ENABLE_QT         "Set to ON to build the internal Qt launcher" ON)
 
 if(LOGGING)
     # nothing
@@ -279,13 +280,14 @@ list(APPEND SQLITE3_LIBRARY ${CMAKE_THREAD_LIBS_INIT})
 
 ##############################################################################
 ## Qt5 setup setup
-
-find_package(Qt5 5.1 COMPONENTS Widgets)
-if (Qt5Widgets_FOUND)
-    message(STATUS "Will enable Qt launcher GUI")
-    set(HAVE_QT 1)
-endif()
-
+if (ENABLE_QT)
+       message(STATUS "Qt launcher enabled, checking for Qt 5.1 / qmake")
+       find_package(Qt5 5.1 COMPONENTS Widgets)
+       if (Qt5Widgets_FOUND)
+               message(STATUS "Will enable Qt launcher GUI")
+               set(HAVE_QT 1)
+       endif()
+endif (ENABLE_QT)
 ##############################################################################
 
 find_package(PLIB REQUIRED puaux pu js fnt)
index b578e464a4b9a67c8de9432c96a9935943f3dd03..ebcb6bb7f21cb32cdf9f5e8eaab687385b0fe8b3 100644 (file)
@@ -401,13 +401,6 @@ static void logToFile()
 // Main top level initialization
 int fgMainInit( int argc, char **argv )
 {
-#if defined(HAVE_QT)
-    QApplication app(argc, argv);
-    app.setOrganizationName("FlightGear");
-    app.setApplicationName("FlightGear");
-    app.setOrganizationDomain("flightgear.org");
-#endif
-
     // set default log levels
     sglog().setLogLevels( SG_ALL, SG_ALERT );
 
@@ -464,7 +457,12 @@ int fgMainInit( int argc, char **argv )
     // environment variables. This avoids needed a wrapper shell-script on OS-X.
     showLauncher |= (::getenv("FG_LAUNCHER") != 0);
 
-    if (showLauncher) {
+    if (showLauncher) {        
+        QApplication app(argc, argv);
+        app.setOrganizationName("FlightGear");
+        app.setApplicationName("FlightGear");
+        app.setOrganizationDomain("flightgear.org");
+    
         // avoid double Apple menu and other weirdness if both Qt and OSG
         // try to initialise various Cocoa structures.
         flightgear::WindowBuilder::setPoseAsStandaloneApp(false);