Allow and glob multiple .conf files in module subdirectory.

This commit is contained in:
Teo Mrnjavac 2015-09-09 18:55:08 +02:00
parent 9facef63c6
commit 2d64a9df00
2 changed files with 14 additions and 8 deletions

View File

@ -1,5 +1,7 @@
include( CMakeColors )
set( MODULE_DATA_DESTINATION share/calamares/modules )
function( calamares_add_module_subdirectory )
set( SUBDIRECTORY ${ARGV0} )
@ -10,7 +12,6 @@ function( calamares_add_module_subdirectory )
elseif( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/module.desc" )
set( MODULES_DIR ${CMAKE_INSTALL_LIBDIR}/calamares/modules )
set( MODULE_DESTINATION ${MODULES_DIR}/${SUBDIRECTORY} )
set( MODULE_CONFIG_FILE ${SUBDIRECTORY}.conf )
# We glob all the files inside the subdirectory, and we make sure they are
# synced with the bindir structure and installed.
@ -19,9 +20,11 @@ function( calamares_add_module_subdirectory )
if( NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${MODULE_FILE} )
configure_file( ${SUBDIRECTORY}/${MODULE_FILE} ${SUBDIRECTORY}/${MODULE_FILE} COPYONLY )
if( "${MODULE_FILE}" STREQUAL "${MODULE_CONFIG_FILE}" )
get_filename_component( FLEXT ${MODULE_FILE} EXT )
if( "${FLEXT}" STREQUAL ".conf" )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/${MODULE_FILE}
DESTINATION share/calamares/modules )
DESTINATION ${MODULE_DATA_DESTINATION} )
list( APPEND MODULE_CONFIG_FILES ${MODULE_FILE} )
else()
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/${MODULE_FILE}
DESTINATION ${MODULE_DESTINATION} )
@ -34,6 +37,9 @@ function( calamares_add_module_subdirectory )
message( " ${Green}TYPE:${ColorReset} jobmodule" )
# message( " ${Green}FILES:${ColorReset} ${MODULE_FILES}" )
message( " ${Green}MODULE_DESTINATION:${ColorReset} ${MODULE_DESTINATION}" )
if( MODULE_CONFIG_FILES )
message( " ${Green}CONFIGURATION_FILES:${ColorReset} ${MODULE_CONFIG_FILES} => ${MODULE_DATA_DESTINATION}" )
endif()
message( "" )
endif()
else()

View File

@ -11,7 +11,7 @@ function( calamares_add_plugin )
set( PLUGIN_NAME ${NAME} )
set( PLUGIN_DESTINATION ${CMAKE_INSTALL_LIBDIR}/calamares/modules/${PLUGIN_NAME} )
set( PLUGIN_DESC_FILE module.desc )
set( PLUGIN_CONFIG_FILE ${NAME}.conf )
file( GLOB PLUGIN_CONFIG_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.conf" )
set( PLUGIN_DATA_DESTINATION share/calamares/modules )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" )
@ -27,8 +27,8 @@ function( calamares_add_plugin )
# message( " ${Green}EXPORT_MACRO:${ColorReset} ${PLUGIN_EXPORT_MACRO}" )
# message( " ${Green}NO_INSTALL:${ColorReset} ${PLUGIN_NO_INSTALL}" )
message( " ${Green}PLUGIN_DESTINATION:${ColorReset} ${PLUGIN_DESTINATION}" )
if( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PLUGIN_CONFIG_FILE}" )
message( " ${Green}CONFIGURATION_FILE:${ColorReset} ${PLUGIN_CONFIG_FILE} => ${PLUGIN_DATA_DESTINATION}" )
if( PLUGIN_CONFIG_FILES )
message( " ${Green}CONFIGURATION_FILES:${ColorReset} ${PLUGIN_CONFIG_FILES} => ${PLUGIN_DATA_DESTINATION}" )
endif()
if( PLUGIN_RESOURCES )
message( " ${Green}RESOURCES:${ColorReset} ${PLUGIN_RESOURCES}" )
@ -78,9 +78,9 @@ function( calamares_add_plugin )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${PLUGIN_DESC_FILE}
DESTINATION ${PLUGIN_DESTINATION} )
if( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PLUGIN_CONFIG_FILE}" )
foreach( PLUGIN_CONFIG_FILE ${PLUGIN_CONFIG_FILES} )
configure_file( ${PLUGIN_CONFIG_FILE} ${PLUGIN_CONFIG_FILE} COPYONLY )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${PLUGIN_CONFIG_FILE}
DESTINATION ${PLUGIN_DATA_DESTINATION} )
endif()
endforeach()
endfunction()