From 3ed04dedeb69747facd2e8008fdf6ea4c7a12d00 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao Date: Thu, 19 Oct 2023 13:30:49 +0800 Subject: [PATCH] cmake: minor tweaks --- FramelessHelperConfig.cmake.in | 21 ++++++++++++++++----- cmake | 2 +- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/FramelessHelperConfig.cmake.in b/FramelessHelperConfig.cmake.in index 36b056c1..e8f60c0c 100644 --- a/FramelessHelperConfig.cmake.in +++ b/FramelessHelperConfig.cmake.in @@ -24,19 +24,25 @@ @PACKAGE_INIT@ +include(CMakeFindDependencyMacro) + set(_@PROJECT_NAME@_supported_components Core Widgets Quick) +set(_@PROJECT_NAME@_available_components Core Gui) -foreach(_comp ${@PROJECT_NAME@_FIND_COMPONENTS}) - if(_comp IN_LIST _@PROJECT_NAME@_supported_components) - set(__target @PROJECT_NAME@::${_comp}) +foreach(_component ${@PROJECT_NAME@_FIND_COMPONENTS}) + if(_component IN_LIST _@PROJECT_NAME@_supported_components) + set(__target @PROJECT_NAME@::${_component}) if(TARGET ${__target}) continue() else() - set(__target_full @PROJECT_NAME@${_comp}) + set(__target_full @PROJECT_NAME@${_component}) set(__targets_file "${CMAKE_CURRENT_LIST_DIR}/${__target_full}Targets.cmake") if(EXISTS "${__targets_file}") include("${__targets_file}") add_library(${__target} ALIAS @PROJECT_NAME@::${__target_full}) + if(NOT "x${_component}" STREQUAL "xCore") + list(APPEND _@PROJECT_NAME@_available_components ${_component}) + endif() else() set(@PROJECT_NAME@_FOUND FALSE) set(@PROJECT_NAME@_NOT_FOUND_MESSAGE "Can't find necessary configuration file for ${__target}, please make sure this component is built successfully and installed properly.") @@ -67,4 +73,9 @@ include(FeatureSummary) set_package_properties(@PROJECT_NAME@ PROPERTIES DESCRIPTION "@PROJECT_DESCRIPTION@" URL "@PROJECT_HOMEPAGE_URL@" -) \ No newline at end of file +) + +if(${@PROJECT_NAME@_FOUND}) + find_dependency(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS ${_@PROJECT_NAME@_available_components}) + find_dependency(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS ${_@PROJECT_NAME@_available_components}) +endif() diff --git a/cmake b/cmake index e15d7d9b..6939b41e 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit e15d7d9bf98de4ba8aa7d89c505164711ee7d8aa +Subproject commit 6939b41eb68450fa06d8d701454031b2328e14c5