forked from qt-creator/qt-creator
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:
@@ -129,6 +129,9 @@ function(add_qtc_library name)
|
|||||||
"CONDITION;DEPENDS;PUBLIC_DEPENDS;DEFINES;PUBLIC_DEFINES;INCLUDES;SYSTEM_INCLUDES;PUBLIC_INCLUDES;PUBLIC_SYSTEM_INCLUDES;SOURCES;EXPLICIT_MOC;SKIP_AUTOMOC;EXTRA_TRANSLATIONS;PROPERTIES;PRIVATE_COMPILE_OPTIONS;PUBLIC_COMPILE_OPTIONS" ${ARGN}
|
"CONDITION;DEPENDS;PUBLIC_DEPENDS;DEFINES;PUBLIC_DEFINES;INCLUDES;SYSTEM_INCLUDES;PUBLIC_INCLUDES;PUBLIC_SYSTEM_INCLUDES;SOURCES;EXPLICIT_MOC;SKIP_AUTOMOC;EXTRA_TRANSLATIONS;PROPERTIES;PRIVATE_COMPILE_OPTIONS;PUBLIC_COMPILE_OPTIONS" ${ARGN}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
check_library_dependencies(${_arg_DEPENDS})
|
||||||
|
check_library_dependencies(${_arg_PUBLIC_DEPENDS})
|
||||||
|
|
||||||
get_default_defines(default_defines_copy ${_arg_ALLOW_ASCII_CASTS})
|
get_default_defines(default_defines_copy ${_arg_ALLOW_ASCII_CASTS})
|
||||||
|
|
||||||
if (${_arg_UNPARSED_ARGUMENTS})
|
if (${_arg_UNPARSED_ARGUMENTS})
|
||||||
@@ -336,6 +339,9 @@ function(add_qtc_plugin target_name)
|
|||||||
${ARGN}
|
${ARGN}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
check_library_dependencies(${_arg_DEPENDS})
|
||||||
|
check_library_dependencies(${_arg_PUBLIC_DEPENDS})
|
||||||
|
|
||||||
if (${_arg_UNPARSED_ARGUMENTS})
|
if (${_arg_UNPARSED_ARGUMENTS})
|
||||||
message(FATAL_ERROR "add_qtc_plugin had unparsed arguments")
|
message(FATAL_ERROR "add_qtc_plugin had unparsed arguments")
|
||||||
endif()
|
endif()
|
||||||
@@ -560,6 +566,8 @@ function(add_qtc_plugin target_name)
|
|||||||
${_arg_PROPERTIES}
|
${_arg_PROPERTIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set_property(TARGET ${target_name} APPEND PROPERTY EXPORT_PROPERTIES "QTC_PLUGIN_CLASS_NAME")
|
||||||
|
|
||||||
if (NOT _arg_SKIP_PCH)
|
if (NOT _arg_SKIP_PCH)
|
||||||
enable_pch(${target_name})
|
enable_pch(${target_name})
|
||||||
endif()
|
endif()
|
||||||
@@ -615,6 +623,9 @@ function(extend_qtc_plugin target_name)
|
|||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
check_library_dependencies(${_arg_DEPENDS})
|
||||||
|
check_library_dependencies(${_arg_PUBLIC_DEPENDS})
|
||||||
|
|
||||||
extend_qtc_target(${target_name} ${ARGN})
|
extend_qtc_target(${target_name} ${ARGN})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
@@ -624,6 +635,9 @@ function(extend_qtc_library target_name)
|
|||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
check_library_dependencies(${_arg_DEPENDS})
|
||||||
|
check_library_dependencies(${_arg_PUBLIC_DEPENDS})
|
||||||
|
|
||||||
extend_qtc_target(${target_name} ${ARGN})
|
extend_qtc_target(${target_name} ${ARGN})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
@@ -361,6 +361,10 @@ function(find_dependent_plugins varName)
|
|||||||
if(NOT TARGET ${i})
|
if(NOT TARGET ${i})
|
||||||
continue()
|
continue()
|
||||||
endif()
|
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)
|
set(_dep)
|
||||||
get_property(_dep TARGET "${i}" PROPERTY _arg_DEPENDS)
|
get_property(_dep TARGET "${i}" PROPERTY _arg_DEPENDS)
|
||||||
if (_dep)
|
if (_dep)
|
||||||
@@ -377,6 +381,18 @@ function(find_dependent_plugins varName)
|
|||||||
set("${varName}" ${_RESULT} PARENT_SCOPE)
|
set("${varName}" ${_RESULT} PARENT_SCOPE)
|
||||||
endfunction()
|
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)
|
function(enable_pch target)
|
||||||
if (BUILD_WITH_PCH)
|
if (BUILD_WITH_PCH)
|
||||||
# Skip PCH for targets that do not use the expected visibility settings:
|
# Skip PCH for targets that do not use the expected visibility settings:
|
||||||
|
Reference in New Issue
Block a user