summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-05-16 13:22:44 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-05-17 11:10:31 +0000
commit85b038a0a23625bd45ff7b39f9db83d274bb33d5 (patch)
tree168f145fe2ec6647332bff3ed5533317f53c438c /cmake
parent3a9ffadf69cba54bc0383d99fc973cacbb74d74b (diff)
Copy feature properties from GlobalConfig to Core target
Current lates CMake has a limitation that it does not allow exporting custom properties from INTERFACE libraries. GlobalConfig is such a library, which means that so far all the global features were not actually exported. Copy the feature property values from GlobalConfig to Core. Because Core is an actual shared library, it keeps the custom properties when exported, and thus Core feature properties will contain the sum of Core and GlobalConfig feature values. Change-Id: Idde305cbaf9ab85ecfbe29522dcbac1c44022b17 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtFeature.cmake25
1 files changed, 25 insertions, 0 deletions
diff --git a/cmake/QtFeature.cmake b/cmake/QtFeature.cmake
index 6c6c2eedbb..d11a711788 100644
--- a/cmake/QtFeature.cmake
+++ b/cmake/QtFeature.cmake
@@ -427,6 +427,7 @@ function(qt_feature_module_end)
set_property(TARGET "${target}" PROPERTY ${propertyPrefix}QT_${capitalState}_${capitalVisibility}_FEATURES "${${state}_${visibility}_features}")
endforeach()
endforeach()
+ qt_feature_copy_global_config_features_to_core(${target})
endif()
unset(__QtFeature_library PARENT_SCOPE)
@@ -443,6 +444,30 @@ function(qt_feature_module_end)
unset(__QtFeature_define_definitions PARENT_SCOPE)
endfunction()
+function(qt_feature_copy_global_config_features_to_core target)
+ # CMake doesn't support setting custom properties on exported INTERFACE libraries
+ # See https://gitlab.kitware.com/cmake/cmake/issues/19261.
+ # To circumvent that, copy the properties from GlobalConfig to Core target.
+ # This way the global features actually get set in the generated CoreTargets.cmake file.
+ if(target STREQUAL Core)
+ foreach(visibility public private)
+ string(TOUPPER "${visibility}" capitalVisibility)
+ foreach(state enabled disabled)
+ string(TOUPPER "${state}" capitalState)
+
+ set(core_property_name "QT_${capitalState}_${capitalVisibility}_FEATURES")
+ set(global_property_name "INTERFACE_${core_property_name}")
+
+ get_property(core_values TARGET Core PROPERTY ${core_property_name})
+ get_property(global_values TARGET GlobalConfig PROPERTY ${global_property_name})
+
+ set(total_values ${core_values} ${global_values})
+ set_property(TARGET Core PROPERTY ${core_property_name} ${total_values})
+ endforeach()
+ endforeach()
+ endif()
+endfunction()
+
function(qt_config_compile_test name)
cmake_parse_arguments(arg "" "LABEL" "LIBRARIES;CODE" ${ARGN})