CMake build: Fix qtc_extend_plugin if plugin is disabled by CONDITION

It should be a no-op in that case, but still error if the plugin target
name passed to qtc_extend_plugin is wrong.

Change-Id: I97579e658d4b42108fbc2600aad550c6a7b7f11b
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Eike Ziller
2019-05-28 12:03:24 +02:00
parent cc877949ca
commit 9989406106

View File

@@ -193,8 +193,14 @@ function(find_dependent_plugins varName)
endfunction()
function(qtc_plugin_enabled varName name)
string(TOUPPER "BUILD_PLUGIN_${name}" _build_plugin_var)
set(${varName} ${${_build_plugin_var}} PARENT_SCOPE)
if (NOT (name IN_LIST __QTC_PLUGINS))
message(FATAL_ERROR "extend_qtc_plugin: Unknown plugin target \"${name}\"")
endif()
if (TARGET ${name})
set(${varName} ON PARENT_SCOPE)
else()
set(${varName} OFF PARENT_SCOPE)
endif()
endfunction()
function(add_qtc_plugin target_name)