@ -6,9 +6,12 @@ set( MODULE_DATA_DESTINATION share/calamares/modules )
function ( calamares_add_module_subdirectory )
function ( calamares_add_module_subdirectory )
set ( SUBDIRECTORY ${ ARGV0 } )
set ( SUBDIRECTORY ${ ARGV0 } )
set ( MODULE_CONFIG_FILES "" )
# I f t h i s s u b d i r e c t o r y h a s a C M a k e L i s t s . t x t , w e a d d _ s u b d i r e c t o r y i t . . .
# I f t h i s s u b d i r e c t o r y h a s a C M a k e L i s t s . t x t , w e a d d _ s u b d i r e c t o r y i t . . .
if ( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/CMakeLists.txt" )
if ( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/CMakeLists.txt" )
add_subdirectory ( ${ SUBDIRECTORY } )
add_subdirectory ( ${ SUBDIRECTORY } )
file ( GLOB MODULE_CONFIG_FILES RELATIVE ${ CMAKE_CURRENT_SOURCE_DIR } / ${ SUBDIRECTORY } "${SUBDIRECTORY}/*.conf" )
# . . . o t h e r w i s e , w e l o o k f o r a m o d u l e . d e s c .
# . . . o t h e r w i s e , w e l o o k f o r a m o d u l e . d e s c .
elseif ( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/module.desc" )
elseif ( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/module.desc" )
set ( MODULES_DIR ${ CMAKE_INSTALL_LIBDIR } /calamares/modules )
set ( MODULES_DIR ${ CMAKE_INSTALL_LIBDIR } /calamares/modules )
@ -39,12 +42,6 @@ function( calamares_add_module_subdirectory )
# message ( " ${Green}FILES:${ColorReset} ${MODULE_FILES}" )
# message ( " ${Green}FILES:${ColorReset} ${MODULE_FILES}" )
message ( " ${Green}MODULE_DESTINATION:${ColorReset} ${MODULE_DESTINATION}" )
message ( " ${Green}MODULE_DESTINATION:${ColorReset} ${MODULE_DESTINATION}" )
if ( MODULE_CONFIG_FILES )
if ( MODULE_CONFIG_FILES )
if ( BUILD_TESTING )
foreach ( _config_file ${ MODULE_CONFIG_FILES } )
add_test ( NAME config- ${ SUBDIRECTORY }
C O M M A N D t e s t _ c o n f $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / $ { S U B D I R E C T O R Y } / $ { _ c o n f i g _ f i l e } )
endforeach ( )
endif ( )
if ( INSTALL_CONFIG )
if ( INSTALL_CONFIG )
message ( " ${Green}CONFIGURATION_FILES:${ColorReset} ${MODULE_CONFIG_FILES} => ${MODULE_DATA_DESTINATION}" )
message ( " ${Green}CONFIGURATION_FILES:${ColorReset} ${MODULE_CONFIG_FILES} => ${MODULE_DATA_DESTINATION}" )
else ( )
else ( )
@ -62,9 +59,23 @@ function( calamares_add_module_subdirectory )
R E N A M E c a l a m a r e s - $ { S U B D I R E C T O R Y } . m o
R E N A M E c a l a m a r e s - $ { S U B D I R E C T O R Y } . m o
)
)
endif ( )
endif ( )
else ( )
else ( )
message ( "-- ${BoldYellow}Warning:${ColorReset} tried to add module subdirectory ${BoldRed}${SUBDIRECTORY}${ColorReset} which has no CMakeLists.txt or module.desc." )
message ( "-- ${BoldYellow}Warning:${ColorReset} tried to add module subdirectory ${BoldRed}${SUBDIRECTORY}${ColorReset} which has no CMakeLists.txt or module.desc." )
message ( "" )
message ( "" )
endif ( )
endif ( )
# C h e c k a n y c o n f i g f i l e s f o r b a s i c c o r r e c t n e s s
if ( BUILD_TESTING AND MODULE_CONFIG_FILES )
set ( _count 0 )
foreach ( _config_file ${ MODULE_CONFIG_FILES } )
set ( _count_str "-${_count}" )
if ( _count EQUAL 0 )
set ( _count_str "" )
endif ( )
add_test (
N A M E c o n f i g - $ { S U B D I R E C T O R Y } $ { _ c o u n t _ s t r }
C O M M A N D t e s t _ c o n f $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / $ { S U B D I R E C T O R Y } / $ { _ c o n f i g _ f i l e } )
math ( EXPR _count "${_count} + 1" )
endforeach ( )
endif ( )
endfunction ( )
endfunction ( )