CMake: Fix import of features while generating CMakeLists

extend_target does not import public and private features.
For example:
Qt::CorePrivate matches as ('CorePrivate'), but it should be ('Core', 'Private')

Change-Id: I99144d42b7e0a8f7c4501d3e0eaf04b270c6b4d6
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Mikhail Svetkin 2018-11-06 00:08:03 +01:00
parent 806595c5b6
commit 1dd5acf9aa

View File

@ -435,17 +435,20 @@ function(extend_target target)
qt_internal_process_automatic_sources("${target}" "${_arg_SOURCES}")
foreach(dep ${_arg_LIBRARIES} ${_arg_PUBLIC_LIBRARIES})
if("${dep}" MATCHES "^Qt::(.+)(Private)?$")
set(depTarget ${CMAKE_MATCH_1})
if("${dep}" MATCHES "^Qt::((.+)(Private)|(.+))$")
if (${CMAKE_MATCH_COUNT} EQUAL 3)
set(depTarget ${CMAKE_MATCH_2})
else()
set(depTarget ${CMAKE_MATCH_4})
endif()
# Fetch features from dependencies and make them available to the
# caller as well as to the local scope for configure.cmake evaluation.
if(NOT TARGET "${dep}")
find_package(Qt${PROJECT_VERSION_MAJOR}${depTarget} REQUIRED)
endif()
if("x${CMAKE_MATCH_2}" STREQUAL "xPrivate")
if("x${CMAKE_MATCH_3}" STREQUAL "xPrivate")
qt_pull_features_into_current_scope(PRIVATE_FEATURES ${depTarget})
endif()
qt_pull_features_into_current_scope(PUBLIC_FEATURES ${depTarget})