From 09f9203baa56fa2ad89ae74046ae8690bcae678b Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Mon, 6 Feb 2023 22:17:15 +0100 Subject: [PATCH] fix building and packaging issue with macos and qt plugins, they do not yet support versionless as it is a problem with cmake --- CMakeLists.txt | 17 ++++++++--------- extern/osgQt/CMakeLists.txt | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f8bee32c86..fe432d5cd2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -236,14 +236,13 @@ find_package(OpenGL REQUIRED) find_package(LZ4 REQUIRED) if (USE_QT) - find_package(Qt5 5.15 COMPONENTS Core Widgets Network OpenGL) - if (Qt5_FOUND) - message(STATUS "Using Qt5") + find_package(QT REQUIRED COMPONENTS Core NAMES Qt6 Qt5) + if (QT_VERSION_MAJOR VERSION_EQUAL 5) + find_package(Qt5 5.15 COMPONENTS Core Widgets Network OpenGL REQUIRED) else() - find_package(Qt6 6.4 COMPONENTS Core Widgets Network OpenGL REQUIRED) - message(STATUS "Using Qt6") - message(STATUS "Warning: Qt6 support is experimental and incomplete") - endif() + find_package(Qt6 COMPONENTS Core Widgets Network OpenGL REQUIRED) + endif() + message(STATUS "Using Qt${QT_VERSION}") endif() set(USED_OSG_COMPONENTS @@ -819,13 +818,13 @@ if (OPENMW_OSX_DEPLOYMENT AND APPLE) message(FATAL_ERROR "macOS packaging requires CMake 3.19 or higher to sign macOS app bundles.") endif () - get_property(QT_COCOA_PLUGIN_PATH TARGET Qt::QCocoaIntegrationPlugin PROPERTY LOCATION_RELEASE) + get_property(QT_COCOA_PLUGIN_PATH TARGET Qt${QT_VERSION_MAJOR}::QCocoaIntegrationPlugin PROPERTY LOCATION_RELEASE) get_filename_component(QT_COCOA_PLUGIN_DIR "${QT_COCOA_PLUGIN_PATH}" DIRECTORY) get_filename_component(QT_COCOA_PLUGIN_GROUP "${QT_COCOA_PLUGIN_DIR}" NAME) get_filename_component(QT_COCOA_PLUGIN_NAME "${QT_COCOA_PLUGIN_PATH}" NAME) configure_file("${QT_COCOA_PLUGIN_PATH}" "${APP_BUNDLE_DIR}/Contents/PlugIns/${QT_COCOA_PLUGIN_GROUP}/${QT_COCOA_PLUGIN_NAME}" COPYONLY) - get_property(QT_QMACSTYLE_PLUGIN_PATH TARGET Qt::QMacStylePlugin PROPERTY LOCATION_RELEASE) + get_property(QT_QMACSTYLE_PLUGIN_PATH TARGET Qt${QT_VERSION_MAJOR}::QMacStylePlugin PROPERTY LOCATION_RELEASE) get_filename_component(QT_QMACSTYLE_PLUGIN_DIR "${QT_QMACSTYLE_PLUGIN_PATH}" DIRECTORY) get_filename_component(QT_QMACSTYLE_PLUGIN_GROUP "${QT_QMACSTYLE_PLUGIN_DIR}" NAME) get_filename_component(QT_QMACSTYLE_PLUGIN_NAME "${QT_QMACSTYLE_PLUGIN_PATH}" NAME) diff --git a/extern/osgQt/CMakeLists.txt b/extern/osgQt/CMakeLists.txt index 6cf2dc9353..724c17e8d0 100644 --- a/extern/osgQt/CMakeLists.txt +++ b/extern/osgQt/CMakeLists.txt @@ -8,7 +8,7 @@ set(OSGQT_SOURCE_FILES add_library(${OSGQT_LIBRARY} STATIC ${OSGQT_SOURCE_FILES}) -target_link_libraries(${OSGQT_LIBRARY} Qt5::Core Qt5::OpenGL) +target_link_libraries(${OSGQT_LIBRARY} Qt::Core Qt::OpenGL) link_directories(${CMAKE_CURRENT_BINARY_DIR})