CMake: Error out on mis-use of qt_pull_features_into_current_scope

Make it a bit harder to mis-use qt_pull_features_into_current_scope.

Change-Id: I2a6be28d7c0e6207217cb1908ec22cc757acd01a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Tobias Hunger 2019-01-10 13:47:25 +01:00
parent 4f26758978
commit 235769d56b

View File

@ -403,8 +403,11 @@ endfunction()
function(qt_pull_features_into_current_scope)
cmake_parse_arguments(arg "PUBLIC_FEATURES;PRIVATE_FEATURES" "" "" ${ARGN})
foreach(target IN ITEMS ${arg_UNPARSED_ARGUMENTS})
if(NOT "${target}" MATCHES "^Qt::[a-zA-z][a-zA-Z0-9_]*$")
message(FATAL_ERROR "${target} does not match Qt::[a-zA-z][a-zA-Z0-9_]*. INVALID NAME.")
endif()
if(NOT TARGET ${target})
continue()
message(FATAL_ERROR "${target} not found.")
endif()
get_target_property(target_type "${target}" TYPE)