Enforce that plugins can't be used as library dependencies

We want to use the libraries in different projects where the plugins
are not present.

Change-Id: I51382ac7cfcf06871ac99a6b53b84840ca39bf00
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Marco Bubke
2024-08-22 12:56:33 +02:00
parent b37f8cfca2
commit 40f462cf07
2 changed files with 30 additions and 0 deletions

View File

@@ -361,6 +361,10 @@ function(find_dependent_plugins varName)
if(NOT TARGET ${i})
continue()
endif()
get_property(_class_name TARGET "${i}" PROPERTY QTC_PLUGIN_CLASS_NAME)
if (NOT _class_name)
message(SEND_ERROR "${i} is a library, not a plugin!")
endif()
set(_dep)
get_property(_dep TARGET "${i}" PROPERTY _arg_DEPENDS)
if (_dep)
@@ -377,6 +381,18 @@ function(find_dependent_plugins varName)
set("${varName}" ${_RESULT} PARENT_SCOPE)
endfunction()
function(check_library_dependencies)
foreach(i ${ARGN})
if (NOT TARGET ${i})
continue()
endif()
get_property(_class_name TARGET "${i}" PROPERTY QTC_PLUGIN_CLASS_NAME)
if (_class_name)
message(SEND_ERROR "${i} is a plugin, not a library!")
endif()
endforeach()
endfunction()
function(enable_pch target)
if (BUILD_WITH_PCH)
# Skip PCH for targets that do not use the expected visibility settings: