Use relative paths for the titlebar icons (FS#809)

The current code used "if(MATCHES)" to decide if a path was inside the source
directory or the build directory. MATCHES uses regular expressions and so this
check failed miserably if the path contained any characters that have a special
meaning in regular expressions (e.g. "+").

Fix this by only using paths inside the build dir for the icons. All icons are
copied from the source dir to the build dir so that we can freely assume that
everything is inside the build directory.

Instead of trying to "transform" the existing paths from the source dir to the
build dir, we use "file(GLOB)"'s RELATIVE option that gives us relative path.
Together with the way "file(COPY)" interprets its arguments, that's all we need.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2010-09-13 16:36:26 +02:00
parent 2f739a5326
commit cd53eb8d3f
1 changed files with 9 additions and 10 deletions

View File

@ -273,22 +273,23 @@ endif()
# }}}
# {{{ Theme icons
file(GLOB icon_sources ${SOURCE_DIR}/themes/*/titlebar/*.png)
file(GLOB icon_sources RELATIVE ${SOURCE_DIR} ${SOURCE_DIR}/themes/*/titlebar/*.png)
set(ALL_ICONS ${icon_sources})
foreach(icon ${icon_sources})
# Copy all icons to the build dir to simplify the following code.
# Source paths are interpreted relative to ${SOURCE_DIR}, target paths
# relative to ${BUILD_DIR}.
get_filename_component(icon_path ${icon} PATH)
file(COPY ${icon} DESTINATION ${icon_path})
endforeach()
macro(a_icon_convert match replacement input)
string(REPLACE ${match} ${replacement} output ${input})
if(NOT ${input} STREQUAL ${output})
if(NOT ${output} MATCHES ${BUILD_DIR})
string(REPLACE ${SOURCE_DIR} ${BUILD_DIR} output ${output})
endif()
set(ALL_ICONS ${ALL_ICONS} ${output})
get_filename_component(output_path ${output} PATH)
file(MAKE_DIRECTORY ${output_path})
add_custom_command(
COMMAND ${CONVERT_EXECUTABLE} ${input} ${ARGN} ${output}
OUTPUT ${output}
@ -340,8 +341,6 @@ endif()
install(DIRECTORY ${AWE_ICON_DIR} DESTINATION ${AWESOME_DATA_PATH})
install(DIRECTORY ${BUILD_DIR}/themes DESTINATION ${AWESOME_DATA_PATH}
PATTERN "*.in" EXCLUDE)
install(DIRECTORY ${SOURCE_DIR}/themes DESTINATION ${AWESOME_DATA_PATH}
PATTERN "*.in" EXCLUDE)
install(FILES ${AWE_DOC_FILES} DESTINATION ${AWESOME_DOC_PATH})
install(FILES "awesome.desktop" DESTINATION ${AWESOME_XSESSION_PATH})
if(GENERATE_LUADOC)