diff options
author | Patrick Valsecchi <patrick@thus.ch> | 2015-02-02 16:52:35 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-02-02 08:00:49 -0800 |
commit | 7e0ff8c1e43e9f8ae76e283046c00223a38cbece (patch) | |
tree | f8267963255cfe5b0c0b219e088eade4ab7dfbfa | |
parent | 343d06fa5c171a4691de03659132f01c2ba5c662 (diff) | |
download | subsurface-7e0ff8c1e43e9f8ae76e283046c00223a38cbece.tar.gz |
Fixed CMakeLists.txt to work with Qt5
Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | CMakeLists.txt | 64 | ||||
-rw-r--r-- | qt-ui/preferences.cpp | 2 |
2 files changed, 28 insertions, 38 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c93b5fd17..c9e32a35f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,5 @@ project(Subsurface) -cmake_minimum_required(VERSION 2.8) - -#options -SET(SUBSURFACE_QT_VERSION "4") +cmake_minimum_required(VERSION 2.8.11) SET(CMAKE_AUTOMOC ON) SET(CMAKE_AUTOUIC ON) @@ -42,23 +39,20 @@ IF(NOT (insource OR insourcedir)) add_custom_target(link_marble_data ALL COMMAND rm -f marbledata && ln -s ${${PROJECT_NAME}_SOURCE_DIR}/marbledata ${${PROJECT_NAME}_BINARY_DIR}/marbledata) ENDIF() -#configure Qt version. -IF(${SUBSURFACE_QT_VERSION} MATCHES "4") - SET(QT_USE_QTNETWORK TRUE) - SET(QT_USE_QTXML TRUE) - SET(QT_USE_QTSVG TRUE) - SET(QT_USE_QTTEST TRUE) - SET(QT_USE_QTWEBKIT TRUE) - FIND_PACKAGE(Qt4 REQUIRED) - INCLUDE(${QT_USE_FILE}) - ADD_DEFINITIONS(${QT_DEFINITIONS}) - FIND_PACKAGE(Marble REQUIRED) - INCLUDE_DIRECTORIES(${MARBLE_INCLUDE_DIR}) -ELSEIF(${SUBSURFACE_QT_VERSION} MATCHES "5") - ADD_DEFINITIONS(-DNO_MARBLE) -ELSE() - message( FATAL_ERROR "Qt version should be 4 or 5" ) -ENDIF() +#configure Qt. +FIND_PACKAGE(Qt5Core REQUIRED) +FIND_PACKAGE(Qt5Concurrent REQUIRED) +FIND_PACKAGE(Qt5Widgets REQUIRED) +FIND_PACKAGE(Qt5Network REQUIRED) +FIND_PACKAGE(Qt5WebKitWidgets REQUIRED) +FIND_PACKAGE(Qt5PrintSupport REQUIRED) +FIND_PACKAGE(Qt5Svg REQUIRED) +FIND_PACKAGE(Qt5Test REQUIRED) +SET(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network Qt5::WebKitWidgets Qt5::PrintSupport Qt5::Svg) +SET(QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt5::Test) + +FIND_PACKAGE(Marble REQUIRED) +INCLUDE_DIRECTORIES(${MARBLE_INCLUDE_DIR}) # Generate the ssrf-config.h every 'make' FILE(WRITE ${CMAKE_BINARY_DIR}/version.h.in "\#define VERSION_STRING \"4.1.\"@VERSION@\n") @@ -186,29 +180,25 @@ SET(SUBSURFACE_APP ) FILE(GLOB SUBSURFACE_UI qt-ui/*.ui) -# to be replaced by QT_WRAP_UI on CMake 3. -IF(${SUBSURFACE_QT_VERSION} MATCHES "4") - QT4_WRAP_UI( SUBSURFACE_UI_HDRS ${SUBSURFACE_UI} ) - QT4_ADD_RESOURCES( SUBSURFACE_QRC_HRDS subsurface.qrc ) -ELSEIF(${SUBSURFACE_QT_VERSION} MATCHES "5") - QT5_WRAP_UI( SUBSURFACE_UI_HDRS ${SUBSURFACE_UI} ) -ENDIF() +QT5_WRAP_UI( SUBSURFACE_UI_HDRS ${SUBSURFACE_UI} ) ADD_LIBRARY(subsurface_corelib STATIC ${SUBSURFACE_CORE_LIB_SRCS} ) +TARGET_LINK_LIBRARIES(subsurface_corelib ${QT_LIBRARIES}) ADD_LIBRARY(subsurface_profile STATIC ${SUBSURFACE_PROFILE_LIB_SRCS}) +TARGET_LINK_LIBRARIES(subsurface_profile ${QT_LIBRARIES}) ADD_LIBRARY(subsurface_statistics STATIC ${SUBSURFACE_STATISTICS_LIB_SRCS}) +TARGET_LINK_LIBRARIES(subsurface_statistics ${QT_LIBRARIES}) ADD_LIBRARY(subsurface_generated_ui STATIC ${SUBSURFACE_UI_HDRS}) ADD_LIBRARY(subsurface_interface STATIC ${SUBSURFACE_INTERFACE}) -ADD_EXECUTABLE(subsurface ${SUBSURFACE_APP} ${SUBSURFACE_QRC_HRDS} ) +TARGET_LINK_LIBRARIES(subsurface_interface ${QT_LIBRARIES} ${MARBLE_LIBRARIES}) +ADD_EXECUTABLE(subsurface ${SUBSURFACE_APP} ${SUBSURFACE_QRC_HRDS} ) target_link_libraries( subsurface subsurface_generated_ui subsurface_interface subsurface_profile subsurface_statistics subsurface_corelib - ${QT_LIBRARIES} - ${MARBLE_LIBRARIES} ${SUBSURFACE_LINK_LIBRARIES} -ldivecomputer -lzip @@ -221,10 +211,10 @@ ADD_DEPENDENCIES(subsurface_generated_ui version) ADD_DEPENDENCIES(subsurface_corelib version) ENABLE_TESTING() -ADD_EXECUTABLE( TestUnitConversion tests/testunitconversion.cpp ) -TARGET_LINK_LIBRARIES( TestUnitConversion ${QT_LIBRARIES} ${SUBSURFACE_LINK_LIBRARIES} -lzip -ldivecomputer subsurface_corelib) -ADD_TEST( NAME TestUnitConversion COMMAND TestUnitConversion) +ADD_EXECUTABLE(TestUnitConversion tests/testunitconversion.cpp) +TARGET_LINK_LIBRARIES(TestUnitConversion subsurface_corelib ${QT_TEST_LIBRARIES} ${SUBSURFACE_LINK_LIBRARIES} -lzip -ldivecomputer) +ADD_TEST(NAME TestUnitConversion COMMAND TestUnitConversion) -ADD_EXECUTABLE( TestProfile tests/testprofile.cpp ) -TARGET_LINK_LIBRARIES( TestProfile ${QT_LIBRARIES} ${SUBSURFACE_LINK_LIBRARIES} -lzip -ldivecomputer subsurface_corelib) -ADD_TEST( NAME TestProfile COMMAND TestProfile) +ADD_EXECUTABLE(TestProfile tests/testprofile.cpp) +TARGET_LINK_LIBRARIES(TestProfile subsurface_corelib ${QT_TEST_LIBRARIES} ${SUBSURFACE_LINK_LIBRARIES} -lzip -ldivecomputer) +ADD_TEST(NAME TestProfile COMMAND TestProfile) diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp index 05d638567..ab241f358 100644 --- a/qt-ui/preferences.cpp +++ b/qt-ui/preferences.cpp @@ -86,7 +86,7 @@ void PreferencesDialog::facebookLoggedIn() void PreferencesDialog::facebookDisconnect() { #if !defined(Q_OS_ANDROID) && defined(FBSUPPORT) - // remove the disconnect button + // remove the connect/disconnect button // and instead add the login view ui.fbLayout->removeItem(ui.fbLayout->itemAt(1)); ui.fbLayout->addWidget(facebookWebView); |