summaryrefslogtreecommitdiffstats
path: root/tests/auto/cmake/test_versionless_targets/force_on/CMakeLists.txt
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2024-01-24 16:12:19 +0100
committerAlexey Edelev <alexey.edelev@qt.io>2024-03-12 20:27:42 +0100
commit173164cd477211e574c0d04abef51aa0f4c3f78d (patch)
treef6ed45b761b5a133ba1ff409aeb99ea076ad304e /tests/auto/cmake/test_versionless_targets/force_on/CMakeLists.txt
parenta1d18276a84f0f72af48c3b899c80d4b9407ef4b (diff)
"Simplify" versionless targets
Versionless targets in Qt6 are interface libraries that link the versioned libraries using the INTERFACE link type. This makes the linking chain more complicated than it can be. Also we miss some significant interface properties in the versionless targets comparing to the versioned targets. The new approach manually generates the versionless targets, instead of using CMake exports. For CMake versions < 3.18 we now create a copy of the versioned targets. The copy includes all the relevant INTERFACE properties from the versioned targets and imported locations for all configs. For CMake versions >= 3.18 we now create the versionless target ALIASes which should behave give the transparent access to the versioned targets. Using the QT_USE_OLD_VERSION_LESS_TARGETS flag you may force the behavor of the CMake versions <= 3.18 The change is partial workaround for QTBUG-86533. Task-number: QTBUG-114706 Change-Id: Iafadf6154eb4912df0697648c031fcc1cbde04e0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'tests/auto/cmake/test_versionless_targets/force_on/CMakeLists.txt')
-rw-r--r--tests/auto/cmake/test_versionless_targets/force_on/CMakeLists.txt20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/cmake/test_versionless_targets/force_on/CMakeLists.txt b/tests/auto/cmake/test_versionless_targets/force_on/CMakeLists.txt
new file mode 100644
index 0000000000..b3d7596143
--- /dev/null
+++ b/tests/auto/cmake/test_versionless_targets/force_on/CMakeLists.txt
@@ -0,0 +1,20 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+
+message("Test enabled versionless targets")
+
+set(QT_NO_CREATE_VERSIONLESS_TARGETS OFF)
+
+find_package(Qt6Core REQUIRED)
+
+if(NOT TARGET Qt6::Core)
+ message(SEND_ERROR "Qt6::Core target not defined!")
+endif()
+
+if(NOT TARGET Qt::Core)
+ message(SEND_ERROR "Qt::Core target not defined!")
+endif()
+
+check_versionless_targets()