New CalamaresAddBrandingSubdirectory macro.

This commit is contained in:
Teo Mrnjavac 2014-10-10 18:07:41 +02:00
parent 006f0e3eef
commit d53643f7cc
3 changed files with 37 additions and 0 deletions

View File

@ -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}"
)

View File

@ -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()

View File

@ -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" )