cmake build: Disable refactoringbackend and pchmanagerbackend

Disable the libs and executables if not needed by either the plugins or
by the tests.

So far in the cmake build the ClangRefactoring and ClangPchManager
plugins were disabled by default, but the backend executables were still
built. With this change the executables are not built if the plugins are
not enabled, like it is the case in the qmake build.

To make it possible to build all the tests even though the plugins are
disabled by default, the backend libraries are still built if tests are
enabled.

Change-Id: I3b61479525e1472a55215f1b003fea9facaf9e93
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
Eike Ziller
2020-11-04 16:46:11 +01:00
parent 4035fc2433
commit d24c34c747
5 changed files with 22 additions and 5 deletions
+18 -5
View File
@@ -546,10 +546,10 @@ endfunction()
function(add_qtc_executable name)
cmake_parse_arguments(_arg "SKIP_INSTALL;SKIP_TRANSLATION;ALLOW_ASCII_CASTS"
"DESTINATION;COMPONENT"
"DEPENDS;DEFINES;INCLUDES;SOURCES;EXPLICIT_MOC;SKIP_AUTOMOC;EXTRA_TRANSLATIONS;PROPERTIES" ${ARGN})
"DESTINATION;COMPONENT;BUILD_DEFAULT"
"CONDITION;DEPENDS;DEFINES;INCLUDES;SOURCES;EXPLICIT_MOC;SKIP_AUTOMOC;EXTRA_TRANSLATIONS;PROPERTIES" ${ARGN})
if ($_arg_UNPARSED_ARGUMENTS)
if (${_arg_UNPARSED_ARGUMENTS})
message(FATAL_ERROR "add_qtc_executable had unparsed arguments!")
endif()
@@ -560,14 +560,27 @@ function(add_qtc_executable name)
update_cached_list(__QTC_EXECUTABLES "${name}")
if (NOT _arg_CONDITION)
set(_arg_CONDITION ON)
endif()
string(TOUPPER "BUILD_EXECUTABLE_${name}" _build_executable_var)
set(_build_executable_default ${BUILD_EXECUTABLES_BY_DEFAULT})
if (DEFINED _arg_BUILD_DEFAULT)
set(_build_executable_default ${_arg_BUILD_DEFAULT})
else()
set(_build_executable_default ${BUILD_EXECUTABLES_BY_DEFAULT})
endif()
if (DEFINED ENV{QTC_${_build_executable_var}})
set(_build_executable_default "$ENV{QTC_${_build_executable_var}}")
endif()
set(${_build_executable_var} "${_build_executable_default}" CACHE BOOL "Build executable ${name}.")
if (NOT ${_build_executable_var})
if ((${_arg_CONDITION}) AND ${_build_executable_var})
set(_executable_enabled ON)
else()
set(_executable_enabled OFF)
endif()
if (NOT _executable_enabled)
return()
endif()