Author: ivanovic
Date: Tue Apr  7 13:59:01 2009
New Revision: 34605

URL: http://svn.gna.org/viewcvs/wesnoth?rev=34605&view=rev
Log:
more changes for installation of desktop files:
* desktop file installation not needed on apple and cygwin
* use the correct Exec= entry and not the default for the .desktop files (since 
this can be changed via prefix/suffix)

Modified:
    branches/1.6/CMakeLists.txt

Modified: branches/1.6/CMakeLists.txt
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/1.6/CMakeLists.txt?rev=34605&r1=34604&r2=34605&view=diff
==============================================================================
--- branches/1.6/CMakeLists.txt (original)
+++ branches/1.6/CMakeLists.txt Tue Apr  7 13:59:01 2009
@@ -69,11 +69,11 @@
 option(ENABLE_NLS "Enable building of tranlations" ON)
 option(ENABLE_POOL_ALLOC "Enable custom pool malloc" OFF)
 option(ENABLE_LOW_MEM "Reduce memory usage by removing extra functionality" 
OFF)
-if (UNIX)
+if (UNIX AND NOT APPLE AND NOT CYGWIN)
   option(ENABLE_DESKTOP_ENTRY "enable installation of desktop entry files" ON)
   set(ICONDIR "${DATAROOTDIR}/pixmaps" CACHE STRING "Sets the icon directory 
for desktop entry to a non-default location.")
   set(DESKTOPDIR "${DATAROOTDIR}/applications/" CACHE STRING "Sets the desktop 
file directory for desktop entry to a non-default location.")
-endif(UNIX)
+endif(UNIX AND NOT APPLE AND NOT CYGWIN)
 
 set(BINARY_SUFFIX "" CACHE STRING "Suffix behind all binaries")
 set(BINARY_PREFIX "" CACHE STRING "Prefix in front of all binaries")
@@ -254,17 +254,27 @@
 endif()
 
 #
-# Install .desktop entries
-#
-if(ENABLE_DESKTOP_ENTRY)
-  # install a desktop file so wesnoth appears in the application start menu 
with an icon
-  install(FILES icons/wesnoth.desktop DESTINATION ${DESKTOPDIR} )
+# Install desktop file so wesnoth appears in the application start menu with 
an icon
+#
+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(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} )
+  # install the generated .desktop file
+  install(FILES ${CMAKE_CURRENT_BINARY_DIR}/wesnoth.desktop DESTINATION 
${DESKTOPDIR} )
   install(FILES icons/wesnoth-icon.png DESTINATION ${ICONDIR} )
+  
   if(ENABLE_EDITOR)
-    install(FILES icons/wesnoth_editor.desktop DESTINATION ${DESKTOPDIR} )
+    # 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} )
+    # install the generated .desktop file
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/wesnoth_editor.desktop 
DESTINATION ${DESKTOPDIR} )
     install(FILES icons/wesnoth_editor-icon.png DESTINATION ${ICONDIR} )
   endif(ENABLE_EDITOR)
-endif(ENABLE_DESKTOP_ENTRY)
+endif(ENABLE_DESKTOP_ENTRY AND ENABLE_GAME)
 
 
 if(ENABLE_SERVER AND FIFO_DIR)


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to