summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorDan Church <amphetamachine@gmail.com>2020-06-18 11:34:19 -0500
committerCharles Pigott <charlespigott@googlemail.com>2020-06-18 21:18:53 +0100
commit506598a80a5285fd5f3b164afbcb69bd9e98c6cc (patch)
tree0320b197f8a618c130394069865b279f0a00085b /cmake
parentb0f192abc4e8bdd9f5f46f6932b8308e32b7b4b6 (diff)
downloadopenttd-506598a80a5285fd5f3b164afbcb69bd9e98c6cc.tar.xz
Fix: [CMake] Fix install paths using GNUInstallDirs
Diffstat (limited to 'cmake')
-rw-r--r--cmake/InstallAndPackage.cmake12
-rw-r--r--cmake/Options.cmake4
2 files changed, 10 insertions, 6 deletions
diff --git a/cmake/InstallAndPackage.cmake b/cmake/InstallAndPackage.cmake
index a84707bc2..71b80e684 100644
--- a/cmake/InstallAndPackage.cmake
+++ b/cmake/InstallAndPackage.cmake
@@ -1,9 +1,11 @@
+include(GNUInstallDirs)
+
# If requested, use FHS layout; otherwise fall back to a flat layout.
if (OPTION_INSTALL_FHS)
- set(BINARY_DESTINATION_DIR "bin")
- set(DATA_DESTINATION_DIR "share/games/openttd")
- set(DOCS_DESTINATION_DIR "share/doc/openttd")
- set(MAN_DESTINATION_DIR "share/man/openttd")
+ set(BINARY_DESTINATION_DIR "${CMAKE_INSTALL_BINDIR}")
+ set(DATA_DESTINATION_DIR "${CMAKE_INSTALL_DATADIR}/openttd")
+ set(DOCS_DESTINATION_DIR "${CMAKE_INSTALL_DOCDIR}")
+ set(MAN_DESTINATION_DIR "${CMAKE_INSTALL_MANDIR}")
else (OPTION_INSTALL_FHS)
set(BINARY_DESTINATION_DIR ".")
set(DATA_DESTINATION_DIR ".")
@@ -40,7 +42,7 @@ install(FILES
if (OPTION_INSTALL_FHS)
install(FILES
${CMAKE_SOURCE_DIR}/docs/openttd.6
- DESTINATION ${MAN_DESTINATION_DIR}
+ DESTINATION ${MAN_DESTINATION_DIR}/man6
COMPONENT manual)
endif (OPTION_INSTALL_FHS)
diff --git a/cmake/Options.cmake b/cmake/Options.cmake
index 0e8063fac..478f1b2b2 100644
--- a/cmake/Options.cmake
+++ b/cmake/Options.cmake
@@ -1,3 +1,5 @@
+include(GNUInstallDirs)
+
# Set the options for the directories (personal, shared, global).
#
# set_directory_options()
@@ -14,7 +16,7 @@ function(set_directory_options)
elseif (UNIX)
set(DEFAULT_PERSONAL_DIR ".openttd")
set(DEFAULT_SHARED_DIR "(not set)")
- set(DEFAULT_GLOBAL_DIR "${CMAKE_INSTALL_PREFIX}/share/games/openttd")
+ set(DEFAULT_GLOBAL_DIR "${CMAKE_INSTALL_FULL_DATADIR}/openttd")
else ()
message(FATAL_ERROR "Unknown OS found; please consider creating a Pull Request to add support for this OS.")
endif ()