summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-06-19 14:49:52 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-06-19 18:41:23 +0200
commit10f8ebe3e2075a02d910f2d02cc0e81abe727c2f (patch)
tree1af4fc9e726d6f6c401e19c32f0fef9ca3f917a3
parent7f2ff4ffce8da68669855b16f5e2ecd9954aa33d (diff)
CMake: Provide the minimum darwin deployment target needed by Qt
This is useful information for people that want to use Qt in their project with CMake. Unfortunately there is no good way to actually set CMAKE_OSX_DEPLOYMENT_TARGET automatically with the Qt provided value, because it needs to be set before the first project() call in a CMake project. This means it can be set either on the command line, or manually by the application developer in CMakeLists.txt before the first project() call or via a CMake toolchain. In Qt 6 we provide a CMake toolchain file with the deployment target already set, so if the application developer uses the Qt generated toolchain, they will get the value automatically. In Qt 5 the value can only be read for informational purposes only, from the QT_DARWIN_MIN_DEPLOYMENT_TARGET property on the Qt5::Core target. The same property is set in Qt 6 for compatibility resons. Task-number: QTBUG-76167 Task-number: QTCREATORBUG-22466 Pick-to: 5.15 Change-Id: Id61d70dc9a1b7a0e7cdb90b1e679171ea178126b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
-rw-r--r--src/corelib/CMakeLists.txt8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt
index 2b1cd8c837..27cb30ff03 100644
--- a/src/corelib/CMakeLists.txt
+++ b/src/corelib/CMakeLists.txt
@@ -1283,6 +1283,14 @@ if(WIN32)
target_link_libraries(Core INTERFACE $<$<AND:${isExe},${isWin32},${isNotExcluded},${isPolicyNEW}>:Qt::WinMain>)
qt_record_extra_qt_package_dependency(Core WinMain "${PROJECT_VERSION}")
endif()
+
+# Record darwin minimum deployment target.
+if(APPLE AND CMAKE_OSX_DEPLOYMENT_TARGET)
+ set_property(TARGET Core PROPERTY
+ QT_DARWIN_MIN_DEPLOYMENT_TARGET "${CMAKE_OSX_DEPLOYMENT_TARGET}")
+ set_property(TARGET Core APPEND PROPERTY
+ EXPORT_PROPERTIES "QT_DARWIN_MIN_DEPLOYMENT_TARGET")
+endif()
# special case end
qt_create_tracepoints(Core qtcore.tracepoints)