summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2021-12-21 17:05:07 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-01-04 10:22:12 +0000
commitae58e2b5936ca112e9aab3434dd8344182816a69 (patch)
tree892379659331f0741eef9604da550cfc81ea5f8b
parentd6b10f37c4dab1dcc073712ae66aa23c12777fc8 (diff)
Exclude sources from HEADER_MODULE if cmake version is less than 3.19
CMake versions less than 3.19 don't support adding the source files to the PRIVATE scope of the INTERFACE libraries. It looks like these PRIVATE sources are only used by IDEs to display them in a project tree. Skip them to avoid configuring issues. Fixes: QTBUG-99316 Change-Id: Id03f540ac9c94e920adfae5de4f364bd7aba4613 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 8e2f101a6bf6c59e707b2747d6df76e8e221e319) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--cmake/QtTargetHelpers.cmake15
1 files changed, 12 insertions, 3 deletions
diff --git a/cmake/QtTargetHelpers.cmake b/cmake/QtTargetHelpers.cmake
index b94a4bdae2..bc4f112560 100644
--- a/cmake/QtTargetHelpers.cmake
+++ b/cmake/QtTargetHelpers.cmake
@@ -51,9 +51,18 @@ function(qt_internal_extend_target target)
endforeach()
# Set-up the target
- target_sources("${target}" PRIVATE ${arg_SOURCES} ${dbus_sources})
- if (arg_COMPILE_FLAGS)
- set_source_files_properties(${arg_SOURCES} PROPERTIES COMPILE_FLAGS "${arg_COMPILE_FLAGS}")
+
+ # CMake versions less than 3.19 don't support adding the source files to the PRIVATE scope
+ # of the INTERFACE libraries. These PRIVATE sources are only needed by IDEs to display
+ # them in a project tree, so to avoid build issues and appearing the sources in
+ # INTERFACE_SOURCES property of HEADER_MODULE let's simply exclude them for compatibility
+ # with CMake versions less than 3.19.
+ if(NOT arg_HEADER_MODULE OR CMAKE_VERSION VERSION_GREATER_EQUAL "3.19")
+ target_sources("${target}" PRIVATE ${arg_SOURCES} ${dbus_sources})
+ if (arg_COMPILE_FLAGS)
+ set_source_files_properties(${arg_SOURCES} PROPERTIES
+ COMPILE_FLAGS "${arg_COMPILE_FLAGS}")
+ endif()
endif()
set(public_visibility_option "PUBLIC")