diff --git a/CMakeLists.txt b/CMakeLists.txt index 841688e65a..789f5fe5ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,15 @@ endif () option(DEPLOY_QT_TRANSLATIONS "Deploy standard Qt translations to resources folder. Needed when OpenMW applications are deployed with Qt libraries" ${DEPLOY_QT_TRANSLATIONS_DEFAULT}) option(OPENMW_DEPLOY_RUNTIME_DEPENDENCIES "Deploy runtime dependency libraries. Needed when not relying on a system-wide insallation of these libraries existing" ${deploy_runtime_dependencies_default}) +set(runtime_dependency_arguments) +if (OPENMW_DEPLOY_RUNTIME_DEPENDENCIES) + if (CMAKE_VERSION VERSION_LESS 3.21) + message(FATAL_ERROR "OPENMW_DEPLOY_RUNTIME_DEPENDENCIES requires at least CMake 3.21") + endif() + # when the version check is made obsolete, we can just pass this whether or not we're using it + set(runtime_dependency_arguments RUNTIME_DEPENDENCY_SET openmw-dependencies) +endif () + # Apps and tools option(BUILD_OPENMW "Build OpenMW" ON) option(BUILD_LAUNCHER "Build Launcher" ON) @@ -499,12 +508,14 @@ if(OPENMW_USE_SYSTEM_OSG) endif() endforeach() - if(WIN32) - set(osg_plugin_destination "${CMAKE_INSTALL_BINDIR}") - else() - set(osg_plugin_destination "${CMAKE_INSTALL_LIBDIR}") + if(NOT OSG_STATIC) + if(WIN32) + set(osg_plugin_destination "${CMAKE_INSTALL_BINDIR}") + else() + set(osg_plugin_destination "${CMAKE_INSTALL_LIBDIR}") + endif() + install(IMPORTED_RUNTIME_ARTIFACTS ${USED_OSG_PLUGINS} DESTINATION "${osg_plugin_destination}/osgPlugins-${OPENSCENEGRAPH_VERSION}" RUNTIME_DEPENDENCY_SET openmw-dependencies) endif() - install(IMPORTED_RUNTIME_ARTIFACTS ${USED_OSG_PLUGINS} DESTINATION "${osg_plugin_destination}/osgPlugins-${OPENSCENEGRAPH_VERSION}" RUNTIME_DEPENDENCY_SET openmw-dependencies) endif() endif() @@ -871,12 +882,7 @@ if (NOT APPLE AND OPENMW_DEPLOY_RUNTIME_DEPENDENCIES) set(systemroot "$ENV{SystemRoot}") # documentation says to use lower-case regex, but drive letter is upper-case and I can't be bothered preserving the case of just one character right now #string(TOLOWER "${systemroot}" systemroot) - if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.20) - cmake_path(NORMAL_PATH systemroot) - else () - file(TO_CMAKE_PATH "${systemroot}" systemroot) - # and just hope there's no mess with double slashes or dots - endif () + cmake_path(NORMAL_PATH systemroot) escape_regex_control_characters(systemroot "${systemroot}") set(post_exclude_regexes ^${systemroot}/) # CMP0207 will avoid the need for this diff --git a/apps/bsatool/CMakeLists.txt b/apps/bsatool/CMakeLists.txt index 14418e3107..a140c0b24e 100644 --- a/apps/bsatool/CMakeLists.txt +++ b/apps/bsatool/CMakeLists.txt @@ -23,7 +23,7 @@ if (BUILD_WITH_CODE_COVERAGE) endif() if (NOT APPLE) - install(TARGETS bsatool RUNTIME_DEPENDENCY_SET openmw-dependencies) + install(TARGETS bsatool ${runtime_dependency_arguments}) endif() if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC) diff --git a/apps/bulletobjecttool/CMakeLists.txt b/apps/bulletobjecttool/CMakeLists.txt index 4fa2ad810c..a90976718f 100644 --- a/apps/bulletobjecttool/CMakeLists.txt +++ b/apps/bulletobjecttool/CMakeLists.txt @@ -20,7 +20,7 @@ if (BUILD_WITH_CODE_COVERAGE) endif() if (NOT APPLE) - install(TARGETS openmw-bulletobjecttool RUNTIME_DEPENDENCY_SET openmw-dependencies) + install(TARGETS openmw-bulletobjecttool ${runtime_dependency_arguments}) endif() if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC) diff --git a/apps/esmtool/CMakeLists.txt b/apps/esmtool/CMakeLists.txt index 0d8643e7a5..0c81b83288 100644 --- a/apps/esmtool/CMakeLists.txt +++ b/apps/esmtool/CMakeLists.txt @@ -30,7 +30,7 @@ if (BUILD_WITH_CODE_COVERAGE) endif() if (NOT APPLE) - install(TARGETS esmtool RUNTIME_DEPENDENCY_SET openmw-dependencies) + install(TARGETS esmtool ${runtime_dependency_arguments}) endif() if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC) diff --git a/apps/essimporter/CMakeLists.txt b/apps/essimporter/CMakeLists.txt index 9cc66c1393..7274e71c4b 100644 --- a/apps/essimporter/CMakeLists.txt +++ b/apps/essimporter/CMakeLists.txt @@ -47,7 +47,7 @@ if (BUILD_WITH_CODE_COVERAGE) endif() if (NOT APPLE) - install(TARGETS openmw-essimporter RUNTIME_DEPENDENCY_SET openmw-dependencies) + install(TARGETS openmw-essimporter ${runtime_dependency_arguments}) endif() if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC) diff --git a/apps/launcher/CMakeLists.txt b/apps/launcher/CMakeLists.txt index b695f27d4e..05c74f8b71 100644 --- a/apps/launcher/CMakeLists.txt +++ b/apps/launcher/CMakeLists.txt @@ -63,7 +63,7 @@ openmw_add_qt_executable(openmw-launcher add_dependencies(openmw-launcher qm-files) if (NOT APPLE) - install(TARGETS openmw-launcher RUNTIME_DEPENDENCY_SET openmw-dependencies) + install(TARGETS openmw-launcher ${runtime_dependency_arguments}) generate_deploy_script_for_qt_app(openmw-launcher) endif () diff --git a/apps/mwiniimporter/CMakeLists.txt b/apps/mwiniimporter/CMakeLists.txt index 027b2e7a01..bc0b80287b 100644 --- a/apps/mwiniimporter/CMakeLists.txt +++ b/apps/mwiniimporter/CMakeLists.txt @@ -23,7 +23,7 @@ if (WIN32) endif() if (NOT APPLE) - install(TARGETS openmw-iniimporter RUNTIME_DEPENDENCY_SET openmw-dependencies) + install(TARGETS openmw-iniimporter ${runtime_dependency_arguments}) endif() if (MINGW) diff --git a/apps/navmeshtool/CMakeLists.txt b/apps/navmeshtool/CMakeLists.txt index c380b38763..0445c7b064 100644 --- a/apps/navmeshtool/CMakeLists.txt +++ b/apps/navmeshtool/CMakeLists.txt @@ -30,7 +30,7 @@ if (BUILD_WITH_CODE_COVERAGE) endif() if (NOT APPLE) - install(TARGETS openmw-navmeshtool RUNTIME_DEPENDENCY_SET openmw-dependencies) + install(TARGETS openmw-navmeshtool ${runtime_dependency_arguments}) endif() if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC) diff --git a/apps/niftest/CMakeLists.txt b/apps/niftest/CMakeLists.txt index 89243bc86c..e444971736 100644 --- a/apps/niftest/CMakeLists.txt +++ b/apps/niftest/CMakeLists.txt @@ -22,7 +22,7 @@ if (BUILD_WITH_CODE_COVERAGE) endif() if (NOT APPLE) - install(TARGETS niftest RUNTIME_DEPENDENCY_SET openmw-dependencies) + install(TARGETS niftest ${runtime_dependency_arguments}) endif() if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC) diff --git a/apps/opencs/CMakeLists.txt b/apps/opencs/CMakeLists.txt index 429bba1cd1..fa7e1279b6 100644 --- a/apps/opencs/CMakeLists.txt +++ b/apps/opencs/CMakeLists.txt @@ -250,7 +250,7 @@ if (WIN32) endif() if (NOT APPLE AND BUILD_OPENCS) - install(TARGETS openmw-cs RUNTIME_DEPENDENCY_SET openmw-dependencies) + install(TARGETS openmw-cs ${runtime_dependency_arguments}) INSTALL(FILES "$/defaults-cs.bin" DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}") generate_deploy_script_for_qt_app(openmw-cs) diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index eef9f49b62..d4c942ef67 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -272,5 +272,5 @@ if (BUILD_WITH_CODE_COVERAGE) endif() if (NOT APPLE AND BUILD_OPENMW) - install(TARGETS openmw RUNTIME_DEPENDENCY_SET openmw-dependencies) + install(TARGETS openmw ${runtime_dependency_arguments}) endif() diff --git a/apps/wizard/CMakeLists.txt b/apps/wizard/CMakeLists.txt index 4d76a23271..ec4f63fa97 100644 --- a/apps/wizard/CMakeLists.txt +++ b/apps/wizard/CMakeLists.txt @@ -92,7 +92,7 @@ if (BUILD_WITH_CODE_COVERAGE) endif() if (NOT APPLE) - install(TARGETS openmw-wizard RUNTIME_DEPENDENCY_SET openmw-dependencies) + install(TARGETS openmw-wizard ${runtime_dependency_arguments}) generate_deploy_script_for_qt_app(openmw-wizard) endif() diff --git a/cmake/OpenMWMacros.cmake b/cmake/OpenMWMacros.cmake index 35c3394dff..f8db187089 100644 --- a/cmake/OpenMWMacros.cmake +++ b/cmake/OpenMWMacros.cmake @@ -162,16 +162,12 @@ macro (openmw_add_qt_executable target) endmacro (openmw_add_qt_executable) function (generate_deploy_script_for_qt_app target) - if (LINUX AND OPENMW_DEPLOY_RUNTIME_DEPENDENCIES) + if (UNIX AND NOT APPLE AND OPENMW_DEPLOY_RUNTIME_DEPENDENCIES) if (Qt6Core_VERSION VERSION_LESS 6.10) message(FATAL_ERROR "Deployment of Qt on Linux requires at least 6.10 (for the INCLUDE_PLUGINS argument)") endif () # don't bother with this on Windows yet as windeployqt includes a bunch of DLLs we don't use - if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.20) - cmake_path(NORMAL_PATH QT_DIR OUTPUT_VARIABLE QT_BASE_DIR) - else () - # just hope it's close enough - endif() + cmake_path(NORMAL_PATH QT_DIR OUTPUT_VARIABLE QT_BASE_DIR) string(REGEX REPLACE "(.+)/lib/cmake/Qt[0-9]+" "\\1" QT_BASE_DIR "${QT_BASE_DIR}") escape_regex_control_characters(QT_BASE_REGEX "${QT_BASE_DIR}") qt_generate_deploy_app_script(TARGET ${target}