diff options
author | Cristian Le <[email protected]> | 2025-03-05 11:27:25 +0100 |
---|---|---|
committer | Cristian Le <[email protected]> | 2025-06-27 20:29:16 +0200 |
commit | 2f9795aba2f1f9ca5fbcca4581b2d89fc468cf07 (patch) | |
tree | 11bf3605e84fec3b4f32f4201a149ea1f8d429b2 /cmake/QtModuleConfig.cmake.in | |
parent | 055985ec8373b8a1bd325468b5ba4f1c1de4eaed (diff) |
Replace `QT_NO_CREATE_TARGETS` with an automated and scoped logic
Effectively check if we are importing while still building the current
project
Task-number: QTBUG-135233
Change-Id: If172617463157e84e1b16fc2354147fabae41084
Reviewed-by: Alexandru Croitor <[email protected]>
Reviewed-by: Alexey Edelev <[email protected]>
Diffstat (limited to 'cmake/QtModuleConfig.cmake.in')
-rw-r--r-- | cmake/QtModuleConfig.cmake.in | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/cmake/QtModuleConfig.cmake.in b/cmake/QtModuleConfig.cmake.in index e3af0299c57..73e83d44e19 100644 --- a/cmake/QtModuleConfig.cmake.in +++ b/cmake/QtModuleConfig.cmake.in @@ -24,12 +24,16 @@ if(NOT DEFINED "@INSTALL_CMAKE_NAMESPACE@@target@_FOUND") set("@INSTALL_CMAKE_NAMESPACE@@target@_FOUND" TRUE) endif() -if (NOT QT_NO_CREATE_TARGETS AND @INSTALL_CMAKE_NAMESPACE@@target@_FOUND) +# Do the checks inside Targets.cmake even when the file is still being generated +include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@[email protected]") + +if(NOT __qt_@target@_skip_include_targets_file AND @INSTALL_CMAKE_NAMESPACE@@target@_FOUND) include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@[email protected]") include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@[email protected]" OPTIONAL) include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@[email protected]" OPTIONAL) + set(__qt_@target@_targets_file_included ON) endif() # Find the private module counterpart. @@ -80,7 +84,7 @@ if (@INSTALL_CMAKE_NAMESPACE@@target@_FOUND endif() unset(__qt_@target@_always_load_private_module) -if (NOT QT_NO_CREATE_TARGETS AND @INSTALL_CMAKE_NAMESPACE@@target@_FOUND) +if(__qt_@target@_targets_file_included) # DEPRECATED # Provide old style variables for includes, compile definitions, etc. # These variables are deprecated and only provided on a best-effort basis to facilitate porting. @@ -210,9 +214,9 @@ else() set(@INSTALL_CMAKE_NAMESPACE@@target@_NOT_FOUND_MESSAGE "Target \"@QT_CMAKE_EXPORT_NAMESPACE@::@target@\" was not found.") - if(QT_NO_CREATE_TARGETS) + if(__qt_@target@_skip_include_targets_file) string(APPEND @INSTALL_CMAKE_NAMESPACE@@target@_NOT_FOUND_MESSAGE - "Possibly due to QT_NO_CREATE_TARGETS being set to TRUE and thus " + "Possibly due to __qt_@target@_skip_include_targets_file being set to TRUE and thus " "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@[email protected] was not " "included to define the target.") endif() |