summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-04-12 14:34:11 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-04-12 16:08:16 +0000
commit4a730fa0b08c68fc01f35b79a43fdd72411f2b83 (patch)
treec43a1ed2b7d9fdcd0092e773b2cf0483650ed940
parent95598e0fa90f369ee4b9e7dc125cb33d5c7b4e49 (diff)
downloadmana-4a730fa0b08c68fc01f35b79a43fdd72411f2b83.tar.gz
mana-4a730fa0b08c68fc01f35b79a43fdd72411f2b83.tar.bz2
mana-4a730fa0b08c68fc01f35b79a43fdd72411f2b83.tar.xz
mana-4a730fa0b08c68fc01f35b79a43fdd72411f2b83.zip
CMake: Use GNUInstallDirs
This should make CMake options a little more standardized. The Windows part could potentially still be unified further. Absolute paths are now only used for the defines and not for values going to install() commands.
-rw-r--r--CMakeLists.txt16
-rw-r--r--po/CMakeLists.txt2
-rw-r--r--src/CMakeLists.txt10
-rw-r--r--src/client.cpp3
4 files changed, 18 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9da0ca6b..f6782168 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,6 +22,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
# where to look for cmake modules
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
+include(GNUInstallDirs)
+
FIND_PACKAGE(Gettext)
OPTION(WITH_OPENGL "Enable OpenGL support" ON)
@@ -31,12 +33,10 @@ OPTION(USE_SYSTEM_GUICHAN "Use system Guichan" ON)
IF (WIN32)
SET(PKG_DATADIR ".")
- SET(LOCALEDIR "share/locale")
SET(PKG_BINDIR ".")
ELSE (WIN32)
- SET(PKG_DATADIR ${CMAKE_INSTALL_PREFIX}/share/mana CACHE PATH "Mana datadir")
- SET(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale)
- SET(PKG_BINDIR ${CMAKE_INSTALL_PREFIX}/bin CACHE PATH "Mana bindir")
+ SET(PKG_DATADIR ${CMAKE_INSTALL_DATAROOTDIR}/mana CACHE PATH "Mana datadir")
+ SET(PKG_BINDIR ${CMAKE_INSTALL_BINDIR})
ENDIF (WIN32)
ADD_SUBDIRECTORY(data)
@@ -66,10 +66,10 @@ IF (GETTEXT_FOUND AND ENABLE_NLS)
ENDIF()
If(UNIX)
- INSTALL(FILES org.manasource.Mana.desktop DESTINATION share/applications)
- INSTALL(FILES org.manasource.Mana.metainfo.xml DESTINATION share/metainfo)
- INSTALL(FILES data/icons/mana.png DESTINATION share/icons/hicolor/128x128/apps RENAME org.manasource.Mana.png)
- INSTALL(FILES data/icons/mana.svg DESTINATION share/icons/hicolor/scalable/apps RENAME org.manasource.Mana.svg)
+ INSTALL(FILES org.manasource.Mana.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
+ INSTALL(FILES org.manasource.Mana.metainfo.xml DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo)
+ INSTALL(FILES data/icons/mana.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps RENAME org.manasource.Mana.png)
+ INSTALL(FILES data/icons/mana.svg DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps RENAME org.manasource.Mana.svg)
ENDIF()
SET(CPACK_PACKAGE_VENDOR "Mana Development Team")
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index 08abb6bf..f2ae4b93 100644
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -30,7 +30,7 @@ MACRO(MANA_GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg)
DEPENDS ${_absPotFile} ${_absFile}
)
- INSTALL(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
+ INSTALL(FILES ${_gmoFile} DESTINATION ${CMAKE_INSTALL_LOCALEDIR}/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
SET(_gmoFiles ${_gmoFiles} ${_gmoFile})
ENDFOREACH (_currentPoFile)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b7300e46..72b44ac6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -18,8 +18,14 @@ IF (CMAKE_COMPILER_IS_GNUCXX)
ENDIF()
SET(FLAGS "-DPACKAGE_VERSION=\\\"${VERSION}\\\"")
-SET(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${PKG_DATADIR}/\\\"")
-SET(FLAGS "${FLAGS} -DLOCALEDIR=\\\"${LOCALEDIR}/\\\"")
+
+IF (WIN32)
+ SET(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${PKG_DATADIR}/\\\"")
+ SET(FLAGS "${FLAGS} -DLOCALEDIR=\\\"${CMAKE_INSTALL_LOCALEDIR}/\\\"")
+ELSE()
+ SET(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${CMAKE_INSTALL_FULL_DATAROOTDIR}/mana/\\\"")
+ SET(FLAGS "${FLAGS} -DLOCALEDIR=\\\"${CMAKE_INSTALL_FULL_LOCALEDIR}/\\\"")
+ENDIF()
IF (ENABLE_MANASERV)
INCLUDE_DIRECTORIES("../libs/enet/include")
diff --git a/src/client.cpp b/src/client.cpp
index 6fd73d4f..6e12a579 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -274,12 +274,11 @@ Client::Client(const Options &options):
}
CFRelease(resourcesURL);
strncat(path, "/data", PATH_MAX - 1);
- resman->addToSearchPath(path, false);
mPackageDir = path;
#else
- resman->addToSearchPath(PKG_DATADIR "data", false);
mPackageDir = PKG_DATADIR "data";
#endif
+ resman->addToSearchPath(mPackageDir, false);
resman->addToSearchPath("data", false);