From d53643f7ccb227070a7776dc101770cc6a0187a3 Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Fri, 10 Oct 2014 18:07:41 +0200 Subject: [PATCH] New CalamaresAddBrandingSubdirectory macro. --- CMakeLists.txt | 3 +++ CalamaresAddBrandingSubdirectory.cmake | 33 ++++++++++++++++++++++++++ CalamaresUse.cmake.in | 1 + 3 files changed, 37 insertions(+) create mode 100644 CalamaresAddBrandingSubdirectory.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 750cf57e1..bbd9928cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,6 +121,7 @@ configure_file( CalamaresUse.cmake.in "${PROJECT_BINARY_DIR}/CalamaresUse.cmake" file( COPY CalamaresAddLibrary.cmake DESTINATION "${PROJECT_BINARY_DIR}" ) file( COPY CalamaresAddModuleSubdirectory.cmake DESTINATION "${PROJECT_BINARY_DIR}" ) file( COPY CalamaresAddPlugin.cmake DESTINATION "${PROJECT_BINARY_DIR}" ) +file( COPY CalamaresAddBrandingSubdirectory.cmake DESTINATION "${PROJECT_BINARY_DIR}" ) set( CALAMARES_LIBRARIES calamares ) @@ -154,7 +155,9 @@ install( "${PROJECT_BINARY_DIR}/CalamaresConfigVersion.cmake" "${PROJECT_BINARY_DIR}/CalamaresUse.cmake" "${PROJECT_BINARY_DIR}/CalamaresAddPlugin.cmake" + "${PROJECT_BINARY_DIR}/CalamaresAddModuleSubdirectory.cmake" "${PROJECT_BINARY_DIR}/CalamaresAddLibrary.cmake" + "${PROJECT_BINARY_DIR}/CalamaresAddBrandingSubdirectory.cmake" DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" ) diff --git a/CalamaresAddBrandingSubdirectory.cmake b/CalamaresAddBrandingSubdirectory.cmake new file mode 100644 index 000000000..7e47d96cd --- /dev/null +++ b/CalamaresAddBrandingSubdirectory.cmake @@ -0,0 +1,33 @@ +include( CMakeColors ) + +function( calamares_add_branding_subdirectory ) + set( SUBDIRECTORY ${ARGV0} ) + + if( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/branding.desc" ) + set( BRANDING_DIR share/calamares/branding ) + set( BRANDING_COMPONENT_DESTINATION ${BRANDING_DIR}/${SUBDIRECTORY} ) + + # We glob all the files inside the subdirectory, and we make sure they are + # synced with the bindir structure and installed. + file( GLOB BRANDING_COMPONENT_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY} "${SUBDIRECTORY}/*" ) + foreach( BRANDING_COMPONENT_FILE ${BRANDING_COMPONENT_FILES} ) + if( NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${BRANDING_COMPONENT_FILE} ) + configure_file( ${SUBDIRECTORY}/${BRANDING_COMPONENT_FILE} ${SUBDIRECTORY}/${BRANDING_COMPONENT_FILE} COPYONLY ) + + install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/${BRANDING_COMPONENT_FILE} + DESTINATION ${BRANDING_COMPONENT_DESTINATION} ) + endif() + endforeach() + + message( "-- ${BoldYellow}Found ${CALAMARES_APPLICATION_NAME} branding component: ${BoldRed}${SUBDIRECTORY}${ColorReset}" ) + if( NOT CMAKE_BUILD_TYPE STREQUAL "Release" ) + message( " ${Green}TYPE:${ColorReset} branding component" ) +# message( " ${Green}FILES:${ColorReset} ${BRANDING_COMPONENT_FILES}" ) + message( " ${Green}BRANDING_COMPONENT_DESTINATION:${ColorReset} ${BRANDING_COMPONENT_DESTINATION}" ) + message( "" ) + endif() + else() + message( "-- ${BoldYellow}Warning:${ColorReset} tried to add branding component subdirectory ${BoldRed}${SUBDIRECTORY}${ColorReset} which has no branding.desc." ) + message( "" ) + endif() +endfunction() diff --git a/CalamaresUse.cmake.in b/CalamaresUse.cmake.in index d31b7d41c..4e8d67ba5 100644 --- a/CalamaresUse.cmake.in +++ b/CalamaresUse.cmake.in @@ -9,3 +9,4 @@ endif() include( "${CALAMARES_CMAKE_DIR}/CalamaresAddLibrary.cmake" ) include( "${CALAMARES_CMAKE_DIR}/CalamaresAddModuleSubdirectory.cmake" ) include( "${CALAMARES_CMAKE_DIR}/CalamaresAddPlugin.cmake" ) +include( "${CALAMARES_CMAKE_DIR}/CalamaresAddBrandingSubdirectory.cmake" )