From cda5d06bd83141bef1b3caa10413d39598814b26 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 2 Nov 2018 12:11:19 +0100 Subject: CMake: Fix import of features Make sure the features of Qt libraries are available when linking to that library via the add_qt_* functions. This was broken for any library that did not end with "Privat" or "Private". Change-Id: Iff0ad441b601e0d131b0e30f2069110806410297 Reviewed-by: Tobias Hunger --- cmake/QtBuild.cmake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'cmake/QtBuild.cmake') diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 3a4f2fbc9c..a0985918c1 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -435,20 +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?)") + if("${dep}" MATCHES "^Qt::(.+)(Private)?$") set(depTarget ${CMAKE_MATCH_1}) # 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") qt_pull_features_into_current_scope(PRIVATE_FEATURES ${depTarget}) endif() qt_pull_features_into_current_scope(PUBLIC_FEATURES ${depTarget}) - if(TARGET "${dep}") - continue() - endif() - find_package(Qt${PROJECT_VERSION_MAJOR}${depTarget} REQUIRED) endif() endforeach() @@ -856,7 +856,7 @@ function(add_qt_test name) "${CMAKE_CURRENT_BINARY_DIR}" "${_arg_INCLUDE_DIRECTORIES}" DEFINES "${_arg_DEFINES}" - LIBRARIES "Qt::Core;Qt::Test;${_arg_LIBRARIES}" + LIBRARIES Qt::Core Qt::Test ${_arg_LIBRARIES} ) add_test(NAME "${name}" COMMAND "${name}" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") -- cgit v1.2.3