New cmake switch to skip installing configuration.

The INSTALL_CONFIG is "on" by default. When set to off,
no *.conf file, both global and related to a single module,
will be installed. A warning message is printed by cmake too,
and the module description is edited to make this visible.

This is useful for testing, when we want to install our
own libraries and binary but keep the configuration of the
live system we are testing on (e.g. path to distro image).

Tested on the master branch.
This commit is contained in:
shainer 2016-11-21 00:32:04 +00:00
parent 34516e9477
commit 8d5fbaafeb
3 changed files with 31 additions and 14 deletions

View File

@ -57,6 +57,7 @@ find_package( PolkitQt5-1 REQUIRED )
option( WITH_PYTHON "Enable Python modules support." ON )
option( WITH_CRASHREPORTER "Build with CrashReporter" ON )
option( INSTALL_CONFIG "Install configuration files" ON)
if( CMAKE_SYSTEM_PROCESSOR MATCHES "arm" OR NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libcrashreporter-qt/CMakeLists.txt" )
message( STATUS "Build of crashreporter disabled." )
@ -170,6 +171,10 @@ if ( NOT WITH_PYTHON )
message( "-- WARNING: Building Calamares without Python support. Python modules will not work.\n" )
endif()
if ( NOT INSTALL_CONFIG )
message( "-- WARNING: Configuration files will not be installed.\n" )
endif()
# Add all targets to the build-tree export set
set( CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/Calamares" CACHE PATH "Installation directory for CMake files" )
set( CMAKE_INSTALL_FULL_CMAKEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}" )
@ -211,12 +216,14 @@ install(
"${CMAKE_INSTALL_CMAKEDIR}"
)
install(
FILES
settings.conf
DESTINATION
share/calamares
)
if (INSTALL_CONFIG)
install(
FILES
settings.conf
DESTINATION
share/calamares
)
endif()
install(
FILES

View File

@ -21,7 +21,7 @@ function( calamares_add_module_subdirectory )
configure_file( ${SUBDIRECTORY}/${MODULE_FILE} ${SUBDIRECTORY}/${MODULE_FILE} COPYONLY )
get_filename_component( FLEXT ${MODULE_FILE} EXT )
if( "${FLEXT}" STREQUAL ".conf" )
if( "${FLEXT}" STREQUAL ".conf" AND INSTALL_CONFIG)
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/${MODULE_FILE}
DESTINATION ${MODULE_DATA_DESTINATION} )
list( APPEND MODULE_CONFIG_FILES ${MODULE_FILE} )
@ -38,7 +38,11 @@ function( calamares_add_module_subdirectory )
# 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}" )
if (INSTALL_CONFIG)
message( " ${Green}CONFIGURATION_FILES:${ColorReset} ${MODULE_CONFIG_FILES} => ${MODULE_DATA_DESTINATION}" )
else()
message( " ${Green}CONFIGURATION_FILES:${ColorReset} ${MODULE_CONFIG_FILES} => [Skipping installation]" )
endif()
endif()
message( "" )
endif()

View File

@ -28,7 +28,11 @@ function( calamares_add_plugin )
# message( " ${Green}NO_INSTALL:${ColorReset} ${PLUGIN_NO_INSTALL}" )
message( " ${Green}PLUGIN_DESTINATION:${ColorReset} ${PLUGIN_DESTINATION}" )
if( PLUGIN_CONFIG_FILES )
message( " ${Green}CONFIGURATION_FILES:${ColorReset} ${PLUGIN_CONFIG_FILES} => ${PLUGIN_DATA_DESTINATION}" )
if ( INSTALL_CONFIG )
message( " ${Green}CONFIGURATION_FILES:${ColorReset} ${PLUGIN_CONFIG_FILES} => ${PLUGIN_DATA_DESTINATION}" )
else()
message( " ${Green}CONFIGURATION_FILES:${ColorReset} ${PLUGIN_CONFIG_FILES} => [Skipping installation]" )
endif()
endif()
if( PLUGIN_RESOURCES )
message( " ${Green}RESOURCES:${ColorReset} ${PLUGIN_RESOURCES}" )
@ -78,9 +82,11 @@ function( calamares_add_plugin )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${PLUGIN_DESC_FILE}
DESTINATION ${PLUGIN_DESTINATION} )
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} )
endforeach()
if ( INSTALL_CONFIG )
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} )
endforeach()
endif()
endfunction()