From 925c9452d0764100625f060a1431b3a454e641ec Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Fri, 20 Jun 2008 12:40:01 +0200 Subject: [PATCH] cmake: macroify CONFIGURE_FILE --- awesomeConfig.cmake | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/awesomeConfig.cmake b/awesomeConfig.cmake index 3b026eff0..d02dd0f98 100644 --- a/awesomeConfig.cmake +++ b/awesomeConfig.cmake @@ -148,30 +148,24 @@ SET(AWESOME_REL_LUA_LIB_PATH ${AWESOME_SHARE}/${PROJECT_AWE_NAME}/lib ) SET(AWESOME_REL_CONF_PATH ${AWESOME_ETC}/${PROJECT_AWE_NAME} ) SET(AWESOME_REL_ICON_PATH ${AWESOME_SHARE}/${PROJECT_AWE_NAME} ) +# Configure files. +SET (AWESOME_CONFIGURE_FILES config.h.in + awesomerc.lua.in + awesome-version-internal.h.in + awesome.doxygen.in) -# Configure awesome config.h from template -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in - ${CMAKE_CURRENT_SOURCE_DIR}/config.h - ESCAPE_QUOTE - @ONLY) +MACRO(a_configure_file file) + STRING(REGEX REPLACE ".in\$" "" outfile ${file}) + MESSAGE(STATUS "Configuring ${outfile}") + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file} + ${CMAKE_CURRENT_SOURCE_DIR}/${outfile} + ESCAPE_QUOTE + @ONLY) +ENDMACRO() -# Confiure awesomerc.lua.in -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/awesomerc.lua.in - ${CMAKE_CURRENT_SOURCE_DIR}/awesomerc.lua - ESCAPE_QUOTE - @ONLY) - -# Configure awesome awesome-version-internal.h from template -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/awesome-version-internal.h.in - ${CMAKE_CURRENT_SOURCE_DIR}/awesome-version-internal.h - ESCAPE_QUOTE - @ONLY) - -# Configure awesome.doxygen -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/awesome.doxygen.in - ${CMAKE_CURRENT_SOURCE_DIR}/awesome.doxygen - ESCAPE_QUOTE - @ONLY) +FOREACH(file ${AWESOME_CONFIGURE_FILES}) + a_configure_file(${file}) +ENDFOREACH() # Execute some header generator EXECUTE_PROCESS(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build-utils/layoutgen.sh