From d987c3ba676455f9461da6c479da9fcc9bcf1b2b Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 23 May 2019 13:40:53 +0200 Subject: [PATCH] CMake build: Read QTC_BUILD_PLUGIN_${NAME} environment as default for BUILD_PLUGIN_${NAME}. This is only used as the default for the CMake cache, so only if you haven't run CMake before. The disadvantage is that just changing the environment variable after the fact will not change anything. The advantage is that the CMake cache keeps reflecting the actual state, which is great for ccmake, the UI in Qt Creator, and other configuration tools. Change-Id: I25448270c29afa31d240072f58f981b8776597f2 Reviewed-by: Orgad Shaneh Reviewed-by: Tobias Hunger --- src/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a889baa3692..f8bbda99275 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -235,7 +235,11 @@ function(add_qtc_plugin target_name) endif() string(TOUPPER "BUILD_PLUGIN_${target_name}" _build_plugin_var) - set(${_build_plugin_var} "ON" CACHE BOOL "Build plugin ${name}.") + set(_build_plugin_default "ON") + if (DEFINED ENV{QTC_${_build_plugin_var}}) + set(_build_plugin_default "$ENV{QTC_${_build_plugin_var}}") + endif() + set(${_build_plugin_var} "${_build_plugin_default}" CACHE BOOL "Build plugin ${name}.") if ((${_arg_CONDITION}) AND ${_build_plugin_var}) set(_plugin_enabled ON)