-if(LINK_EXTRA)
- string(REPLACE "," ";" LINK_EXTRA ${LINK_EXTRA})
- link_libraries(${LINK_EXTRA})
-endif(LINK_EXTRA)
-
-# Build Type
-# We need to make sure it's not empty
-# Supported: Release, RelWithDebugInfo, Debug, Debugfull
-
-# On WIN32, only Release seems to work correctly (?)
-if(WIN32)
- set(DEFAULT_BUILD_TYPE "Release")
-else(WIN32)
- set(DEFAULT_BUILD_TYPE "RelWithDebugInfo")
-endif(WIN32)
+if (LINK_EXTRA)
+ string(REPLACE "," ";" LINK_EXTRA ${LINK_EXTRA})
+ link_libraries(${LINK_EXTRA})
+endif()
+
+
+# Simplify later checks
+if (WANT_MONO OR WANT_QTCLIENT)
+ set(BUILD_GUI true)
+endif()
+if (WANT_MONO OR WANT_CORE)
+ set(BUILD_CORE true)
+endif()
+
+
+# Set up Qt
+#####################################################################
+
+
+if (USE_QT5)
+ message(STATUS "Building with the Qt5 libraries...")
+ set(QT_MIN_VERSION "5.2.0")
+ add_definitions(-DHAVE_QT5)
+else()
+ message(STATUS "Building with the Qt4 libraries...")
+ if (BUILD_GUI)
+ set(QT_MIN_VERSION "4.6.0")
+ else()
+ set(QT_MIN_VERSION "4.4.0")
+ endif()
+endif()
+
+
+if (USE_QT5)
+ find_package(Qt5Core ${QT_MIN_VERSION} REQUIRED)
+ # We need QtWidgets
+ set(CLIENT_QT_MODULES ${CLIENT_QT_MODULES} Widgets)
+
+ # Setup the i18n-related variables
+ find_package(Qt5LinguistTools)
+
+else()
+ # 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 the Qt dir
+ set(ENV{PATH} ${QT}/bin:$ENV{PATH})
+ endif()
+
+ # Now that we have the correct $PATH, lets find Qt!
+ find_package(Qt4 ${QT_MIN_VERSION} REQUIRED)
+endif()
+
+
+# Neither Qt4 nor Qt5 consider lconvert relevant, so they don't support finding it...
+# Rather than shipping hacked buildsys files, let's just infer the path from lrelease
+if (QT_LRELEASE_EXECUTABLE)
+ get_filename_component(_lrelease_path ${QT_LRELEASE_EXECUTABLE} PATH)
+ if (USE_QT5)
+ find_program(QT_LCONVERT_EXECUTABLE NAMES lconvert-qt5 lconvert PATHS ${_lrelease_path} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+ else()
+ find_program(QT_LCONVERT_EXECUTABLE NAMES lconvert-qt4 lconvert PATHS ${_lrelease_path} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+ endif()
+endif()