From 2f6e80dc428431247a19c16ae0f219044c10b0e2 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 27 Jun 2018 13:20:52 -0400 Subject: [PATCH] CMake: always copy the config files to the build directory. Switching to INSTALL_CONFIG=OFF breaks tests by not having them in the build directory. Some logic was coupling not-installing to not-using-in-build-dir too closely. --- .../CalamaresAddModuleSubdirectory.cmake | 13 +++++---- CMakeModules/CalamaresAddPlugin.cmake | 28 ++++++++++--------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/CMakeModules/CalamaresAddModuleSubdirectory.cmake b/CMakeModules/CalamaresAddModuleSubdirectory.cmake index af26f5a74..0b417bdf3 100644 --- a/CMakeModules/CalamaresAddModuleSubdirectory.cmake +++ b/CMakeModules/CalamaresAddModuleSubdirectory.cmake @@ -85,9 +85,11 @@ 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" AND INSTALL_CONFIG) - install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/${MODULE_FILE} - DESTINATION ${MODULE_DATA_DESTINATION} ) + if( "${FLEXT}" STREQUAL ".conf" ) + if( INSTALL_CONFIG ) + install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/${MODULE_FILE} + DESTINATION ${MODULE_DATA_DESTINATION} ) + endif() list( APPEND MODULE_CONFIG_FILES ${MODULE_FILE} ) else() install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/${MODULE_FILE} @@ -102,10 +104,11 @@ function( calamares_add_module_subdirectory ) message( " ${Green}MODULE_DESTINATION:${ColorReset} ${MODULE_DESTINATION}" ) if( MODULE_CONFIG_FILES ) if ( INSTALL_CONFIG ) - message( " ${Green}CONFIGURATION_FILES:${ColorReset} ${MODULE_CONFIG_FILES} => ${MODULE_DATA_DESTINATION}" ) + set( _destination "${MODULE_DATA_DESTINATION}" ) else() - message( " ${Green}CONFIGURATION_FILES:${ColorReset} ${MODULE_CONFIG_FILES} => [Skipping installation]" ) + set( _destination "[Build directory only]" ) endif() + message( " ${Green}CONFIGURATION_FILES:${ColorReset} ${MODULE_CONFIG_FILES} => ${_destination}" ) endif() message( "" ) endif() diff --git a/CMakeModules/CalamaresAddPlugin.cmake b/CMakeModules/CalamaresAddPlugin.cmake index d2f878381..1bf20e4ca 100644 --- a/CMakeModules/CalamaresAddPlugin.cmake +++ b/CMakeModules/CalamaresAddPlugin.cmake @@ -66,17 +66,18 @@ function( calamares_add_plugin ) message( " ${Green}TYPE:${ColorReset} ${PLUGIN_TYPE}" ) message( " ${Green}LINK_LIBRARIES:${ColorReset} ${PLUGIN_LINK_LIBRARIES}" ) message( " ${Green}LINK_PRIVATE_LIBRARIES:${ColorReset} ${PLUGIN_LINK_PRIVATE_LIBRARIES}" ) -# message( " ${Green}SOURCES:${ColorReset} ${PLUGIN_SOURCES}" ) -# message( " ${Green}UI:${ColorReset} ${PLUGIN_UI}" ) -# message( " ${Green}EXPORT_MACRO:${ColorReset} ${PLUGIN_EXPORT_MACRO}" ) -# message( " ${Green}NO_INSTALL:${ColorReset} ${PLUGIN_NO_INSTALL}" ) message( " ${Green}PLUGIN_DESTINATION:${ColorReset} ${PLUGIN_DESTINATION}" ) if( PLUGIN_CONFIG_FILES ) + set( _destination "(unknown)" ) if ( INSTALL_CONFIG AND NOT PLUGIN_NO_INSTALL ) - message( " ${Green}CONFIGURATION_FILES:${ColorReset} ${PLUGIN_CONFIG_FILES} => ${PLUGIN_DATA_DESTINATION}" ) + set( _destination "${PLUGIN_DATA_DESTINATION}" ) + elseif( NOT PLUGIN_NO_INSTALL ) + # Not INSTALL_CONFIG + set( _destination "[Build directory only]" ) else() - message( " ${Green}CONFIGURATION_FILES:${ColorReset} ${PLUGIN_CONFIG_FILES} => [Skipping installation]" ) + set( _destination "[Skipping installation]" ) endif() + message( " ${Green}CONFIGURATION_FILES:${ColorReset} ${PLUGIN_CONFIG_FILES} => ${_destination}" ) endif() if( PLUGIN_RESOURCES ) message( " ${Green}RESOURCES:${ColorReset} ${PLUGIN_RESOURCES}" ) @@ -147,12 +148,13 @@ function( calamares_add_plugin ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${PLUGIN_DESC_FILE} DESTINATION ${PLUGIN_DESTINATION} ) - 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() + foreach( PLUGIN_CONFIG_FILE ${PLUGIN_CONFIG_FILES} ) + configure_file( ${PLUGIN_CONFIG_FILE} ${PLUGIN_CONFIG_FILE} COPYONLY ) + if ( INSTALL_CONFIG ) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/${PLUGIN_CONFIG_FILE} + DESTINATION ${PLUGIN_DATA_DESTINATION} ) + endif() + endforeach() endif() endfunction()