add a prefix and suffix to installed .desktop files

some experiments for adding the prefix/suffix behind the Name.*=.*
expression, so far not successfull and thus commented out
This commit is contained in:
Nils Kneuper 2009-04-07 15:10:45 +00:00
parent 65773c5ed0
commit 87b4ec2123

View file

@ -265,19 +265,23 @@ endif()
if(ENABLE_DESKTOP_ENTRY AND ENABLE_GAME)
# do some crude string replacing to have the real binary name in the .desktop file (read in original .desktop file, replace the Exec= line with the correct value and output the generated file)
file(READ icons/wesnoth.desktop wesnoth-desktop-orig)
#string(REGEX REPLACE "(\nName.*=.*)\n" "\\1 (${BINARY_SUFFIX})\n" wesnoth-desktop-modified ${wesnoth-desktop-orig} )
string(REPLACE "Exec=wesnoth" "Exec=${BINARY_PREFIX}wesnoth${BINARY_SUFFIX}" wesnoth-desktop-modified ${wesnoth-desktop-orig} )
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/wesnoth.desktop ${wesnoth-desktop-modified} )
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_PREFIX}wesnoth${BINARY_SUFFIX}.desktop ${wesnoth-desktop-modified} )
#execute_process(COMMAND sed "-i" "'s/^\(Name.*=.*\)$/\1TEST/g'" ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_PREFIX}wesnoth${BINARY_SUFFIX}.desktop )
#exec_program(sed ARGS "-i" "'s/^\(Name.*=.*\)$/\1TEST/g'" ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_PREFIX}wesnoth${BINARY_SUFFIX}.desktop )
# install the generated .desktop file
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/wesnoth.desktop DESTINATION ${DESKTOPDIR} )
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_PREFIX}wesnoth${BINARY_SUFFIX}.desktop DESTINATION ${DESKTOPDIR} )
install(FILES icons/wesnoth-icon.png DESTINATION ${ICONDIR} )
if(ENABLE_EDITOR)
# do some crude string replacing to have the real binary name in the .desktop file (read in original .desktop file, replace the Exec= line with the correct value and output the generated file)
file(READ icons/wesnoth_editor.desktop wesnoth-editor-desktop-orig)
string(REPLACE "Exec=wesnoth -e" "Exec=${BINARY_PREFIX}wesnoth${BINARY_SUFFIX} -e" wesnoth-editor-desktop-modified ${wesnoth-editor-desktop-orig} )
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/wesnoth_editor.desktop ${wesnoth-editor-desktop-modified} )
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_PREFIX}wesnoth_editor${BINARY_SUFFIX}.desktop ${wesnoth-editor-desktop-modified} )
# install the generated .desktop file
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/wesnoth_editor.desktop DESTINATION ${DESKTOPDIR} )
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_PREFIX}wesnoth_editor${BINARY_SUFFIX}.desktop DESTINATION ${DESKTOPDIR} )
install(FILES icons/wesnoth_editor-icon.png DESTINATION ${ICONDIR} )
endif(ENABLE_EDITOR)
endif(ENABLE_DESKTOP_ENTRY AND ENABLE_GAME)