CMake: improve error-handling for USE_*
If USE_<foo> is given a value that doesn't match **anything**, then bail out. Since USE_* is an explicit distro choice for a specific implementation, it's an error if that implementation is not there.
This commit is contained in:
parent
b2c2b91645
commit
c086d18a26
@ -15,20 +15,23 @@ string( REPLACE " " ";" SKIP_LIST "${SKIP_MODULES}" )
|
|||||||
file( GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*" )
|
file( GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*" )
|
||||||
list( SORT SUBDIRECTORIES )
|
list( SORT SUBDIRECTORIES )
|
||||||
|
|
||||||
# Handle the USE_<foo> variables by looking for subdirectories
|
set( _use_categories "" )
|
||||||
# with a <foo>-<implementation> kind of name.
|
set( _found_categories "" )
|
||||||
foreach( SUBDIRECTORY ${SUBDIRECTORIES} )
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
foreach( SUBDIRECTORY ${SUBDIRECTORIES} )
|
foreach( SUBDIRECTORY ${SUBDIRECTORIES} )
|
||||||
list( FIND SKIP_LIST ${SUBDIRECTORY} DO_SKIP )
|
list( FIND SKIP_LIST ${SUBDIRECTORY} DO_SKIP )
|
||||||
|
|
||||||
set( _skip_reason "user request" )
|
set( _skip_reason "user request" )
|
||||||
|
# Handle the USE_<foo> variables by looking for subdirectories
|
||||||
|
# with a <foo>-<implementation> kind of name.
|
||||||
if( SUBDIRECTORY MATCHES "^[a-zA-Z0-9_]+-" )
|
if( SUBDIRECTORY MATCHES "^[a-zA-Z0-9_]+-" )
|
||||||
string( REGEX REPLACE "^[^-]+-" "" _implementation ${SUBDIRECTORY} )
|
string( REGEX REPLACE "^[^-]+-" "" _implementation ${SUBDIRECTORY} )
|
||||||
string( REGEX REPLACE "-.*" "" _category ${SUBDIRECTORY} )
|
string( REGEX REPLACE "-.*" "" _category ${SUBDIRECTORY} )
|
||||||
if( USE_${_category} )
|
if( USE_${_category} )
|
||||||
if( NOT "${_implementation}" STREQUAL "${USE_${_category}}" )
|
list( APPEND _use_categories ${_category} )
|
||||||
|
if( "${_implementation}" STREQUAL "${USE_${_category}}" )
|
||||||
|
list( APPEND _found_categories ${_category} )
|
||||||
|
else()
|
||||||
list( APPEND SKIP_LIST ${SUBDIRECTORY} )
|
list( APPEND SKIP_LIST ${SUBDIRECTORY} )
|
||||||
set( _skip_reason "USE_${_category}=${USE_${_category}}" )
|
set( _skip_reason "USE_${_category}=${USE_${_category}}" )
|
||||||
set( DO_SKIP 1 )
|
set( DO_SKIP 1 )
|
||||||
@ -54,5 +57,12 @@ endforeach()
|
|||||||
# both before and after the feature summary.
|
# both before and after the feature summary.
|
||||||
calamares_explain_skipped_modules( ${LIST_SKIPPED_MODULES} )
|
calamares_explain_skipped_modules( ${LIST_SKIPPED_MODULES} )
|
||||||
|
|
||||||
|
foreach( _category ${_use_categories} )
|
||||||
|
list( FIND _found_categories ${_category} _found )
|
||||||
|
if ( _found EQUAL -1 )
|
||||||
|
message( FATAL_ERROR "USE_${_category} is set to ${USE_${_category}} and no module matches." )
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
include( CalamaresAddTranslations )
|
include( CalamaresAddTranslations )
|
||||||
add_calamares_python_translations( ${CALAMARES_TRANSLATION_LANGUAGES} )
|
add_calamares_python_translations( ${CALAMARES_TRANSLATION_LANGUAGES} )
|
||||||
|
Loading…
Reference in New Issue
Block a user