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.
This commit is contained in:
Adriaan de Groot 2020-06-12 11:35:23 +02:00
parent 992079bac1
commit 73f8c627bd
2 changed files with 9 additions and 2 deletions

View File

@ -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,

View File

@ -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" )