Skip to content

Commit 91182d7

Browse files
committed
Address the case in which GAME_BINDIR is set to an absolute path
1 parent 61b0c72 commit 91182d7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ SET(SURGESCRIPT_INCLUDE_PATH "${CMAKE_INCLUDE_PATH}" CACHE PATH "Where to look f
117117
SET(PHYSFS_LIBRARY_PATH "${CMAKE_LIBRARY_PATH}" CACHE PATH "Where to look for PhysicsFS")
118118
SET(PHYSFS_INCLUDE_PATH "${CMAKE_INCLUDE_PATH}" CACHE PATH "Where to look for the header files of PhysicsFS")
119119
IF(UNIX)
120-
SET(GAME_BINDIR "games" CACHE PATH "Directory in which the game executable will installed (to be appended to CMAKE_INSTALL_PREFIX)")
121-
SET(GAME_DATADIR "share/games/${GAME_UNIXNAME}" CACHE PATH "Directory in which the game data will be installed")
120+
SET(GAME_BINDIR "games" CACHE PATH "Directory in which the game executable will installed (will be appended to CMAKE_INSTALL_PREFIX if it's a relative path)")
121+
SET(GAME_DATADIR "share/games/${GAME_UNIXNAME}" CACHE PATH "Directory in which the game data will be installed (will be appended to CMAKE_INSTALL_PREFIX if it's a relative path)")
122122
SET(GAME_USERDIRNAME "${GAME_UNIXNAME}" CACHE PATH "Name of the user-modifiable asset directory")
123123
IF(NOT ANDROID)
124124
SET(DESKTOP_ICON_PATH "/usr/share/pixmaps" CACHE PATH "Where to install the icon file")
@@ -163,7 +163,12 @@ generate_file("credits.c")
163163
# They require the absolute path of the icon
164164
IF(DEFINED DESKTOP_ICON_PATH)
165165
CMAKE_PATH(APPEND DESKTOP_ICON_FULLPATH "${DESKTOP_ICON_PATH}" "opensurge.png")
166-
CMAKE_PATH(APPEND DESKTOP_EXEC_FULLPATH "${CMAKE_INSTALL_PREFIX}" "${GAME_BINDIR}" "${GAME_UNIXNAME}")
166+
IF(IS_ABSOLUTE "${GAME_BINDIR}")
167+
CMAKE_PATH(APPEND DESKTOP_EXEC_FULLPATH "${GAME_BINDIR}" "${GAME_UNIXNAME}")
168+
ELSE()
169+
CMAKE_PATH(APPEND DESKTOP_EXEC_FULLPATH "${CMAKE_INSTALL_PREFIX}" "${GAME_BINDIR}" "${GAME_UNIXNAME}")
170+
ENDIF()
171+
167172
generate_file("opensurge.desktop")
168173
generate_file("opensurge.appdata.xml")
169174
ENDIF()

0 commit comments

Comments
 (0)