From 73f8c627bd20ffb2012600f1c5098589f4e602af Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 12 Jun 2020 11:35:23 +0200 Subject: [PATCH] CMake: support out-of-tree builds - The variables that are set for out-of-tree builds are prefixed with to avoid name clashes; make the module-infrastructure respect those instead of the in-tree variable names. - .. and then duplicate the in-tree variables to the out-of-tree variables, so we only need one set of module instructions. --- CMakeLists.txt | 7 +++++++ CMakeModules/CalamaresAddModuleSubdirectory.cmake | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 09e5c6d1d..2a209e2d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -359,6 +359,13 @@ if( NOT PYTHONLIBS_FOUND OR NOT PYTHONQT_FOUND ) set( WITH_PYTHONQT OFF ) endif() +# Now we know the state of the ABI-options, copy them into "Calamares_" +# prefixed variables, to match how the variables would-be-named +# when building out-of-tree. +set(Calamares_WITH_PYTHON ${WITH_PYTHON}) +set(Calamares_WITH_PYTHONQT ${WITH_PYTHONQT}) +set(Calamares_WITH_QML ${WITH_QML}) + ### Transifex Translation status # # Construct language lists for use. If there are p_tx* variables, diff --git a/CMakeModules/CalamaresAddModuleSubdirectory.cmake b/CMakeModules/CalamaresAddModuleSubdirectory.cmake index fe4f34f94..02c1a577f 100644 --- a/CMakeModules/CalamaresAddModuleSubdirectory.cmake +++ b/CMakeModules/CalamaresAddModuleSubdirectory.cmake @@ -70,11 +70,11 @@ function( calamares_add_module_subdirectory ) # _mod_testing boolean if the module should be added to the loadmodule tests file(STRINGS "${_mod_dir}/module.desc" MODULE_INTERFACE REGEX "^interface") if ( MODULE_INTERFACE MATCHES "pythonqt" ) - set( _mod_enabled ${WITH_PYTHONQT} ) + set( _mod_enabled ${Calamares_WITH_PYTHONQT} ) set( _mod_reason "No PythonQt support" ) set( _mod_testing OFF ) elseif ( MODULE_INTERFACE MATCHES "python" ) - set( _mod_enabled ${WITH_PYTHON} ) + set( _mod_enabled ${Calamares_WITH_PYTHON} ) set( _mod_reason "No Python support" ) set( _mod_testing ON ) # Will check syntax and imports, at least elseif ( MODULE_INTERFACE MATCHES "qtplugin" )