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>
This commit is contained in:
parent
3a9ffadf69
commit
85b038a0a2
@ -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})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user