diff --git a/CMakeLists.txt b/CMakeLists.txt index a37763286e..55917df99f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -228,7 +228,7 @@ endif() include(GNUInstallDirs) # todo: force this suffix to match sApplicationName in configurationmanager.cpp set(CMAKE_INSTALL_SYSCONFDIR "${CMAKE_INSTALL_SYSCONFDIR}/openmw") -set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATADIR}/games/openmw") +set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATADIR}/openmw") # Set up common paths if (UNIX AND NOT APPLE) @@ -249,11 +249,13 @@ if (APPLE) elseif(UNIX) # Paths SET(DATAROOTDIR "${CMAKE_INSTALL_DATAROOTDIR}" CACHE PATH "Sets the root of data directories to a non-default location") - SET(GLOBAL_DATA_PATH "${CMAKE_INSTALL_PREFIX}/share/games/" CACHE PATH "Set data path prefix") + # we can't use CMAKE_INSTALL_FULL_DATADIR to get this with our suffix as we add it after including GNUInstallDirs + SET(GLOBAL_DATA_PATH "${CMAKE_INSTALL_FULL_DATAROOTDIR}/openmw" CACHE PATH "Set absolute data path prefix for Global installs. This is baked into the binaries, so MUST be set to the final install path at build time.") SET(ICONDIR "${DATAROOTDIR}/pixmaps" CACHE PATH "Set icon dir") SET(LICDIR "${DATAROOTDIR}/licenses/openmw" CACHE PATH "Sets the openmw license directory to a non-default location.") - SET(GLOBAL_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_SYSCONFDIR}/.." CACHE PATH "Set absolute config dir path for Global installs. This is baked into the binaries, so MUST be set to the final install path at build time.") + # we have to re-add our suffix here, too. + SET(GLOBAL_CONFIG_PATH "${CMAKE_INSTALL_FULL_SYSCONFDIR}/openmw" CACHE PATH "Set absolute config dir path for Global installs. This is baked into the binaries, so MUST be set to the final install path at build time.") set(OPENMW_RESOURCE_FILES "${CMAKE_INSTALL_DATADIR}/resources") endif(APPLE) diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index ffde483d20..85282018f9 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -312,11 +312,6 @@ add_component_dir (stereo add_component_dir (debug debugging debuglog gldebug debugdraw writeflags ) - -IF(NOT WIN32 AND NOT APPLE) - add_compile_definitions(GLOBAL_DATA_PATH="${GLOBAL_DATA_PATH}") - add_compile_definitions(GLOBAL_CONFIG_PATH="${GLOBAL_CONFIG_PATH}") -ENDIF() add_component_dir (files linuxpath androidpath windowspath macospath fixedpath multidircollection collections configurationmanager constrainedfilestream memorystream hash configfileparser openfile constrainedfilestreambuf conversion @@ -327,6 +322,10 @@ if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND NOT CMAKE_CXX_COMPILER_FRONTEND set_source_files_properties(files/configfileparser.cpp PROPERTIES COMPILE_FLAGS -Wno-shadow) endif() +if (NOT WIN32 AND NOT APPLE) + set_source_files_properties(files/linuxpath.cpp PROPERTIES COMPILE_DEFINITIONS "GLOBAL_DATA_PATH=\"${GLOBAL_DATA_PATH}\";GLOBAL_CONFIG_PATH=\"${GLOBAL_CONFIG_PATH}\"") +endif () + add_component_dir (compiler context controlparser errorhandler exception exprparser extensions fileparser generator lineparser literals locals output parser scanner scriptparser skipparser streamerrorhandler diff --git a/components/files/linuxpath.cpp b/components/files/linuxpath.cpp index 8007926d1c..ee0c5325b2 100644 --- a/components/files/linuxpath.cpp +++ b/components/files/linuxpath.cpp @@ -71,8 +71,7 @@ namespace Files std::filesystem::path LinuxPath::getGlobalConfigPath() const { - std::filesystem::path globalPath(GLOBAL_CONFIG_PATH); - return globalPath / mName; + return GLOBAL_CONFIG_PATH; } std::filesystem::path LinuxPath::getLocalPath() const @@ -98,8 +97,7 @@ namespace Files std::filesystem::path LinuxPath::getGlobalDataPath() const { - std::filesystem::path globalDataPath(GLOBAL_DATA_PATH); - return globalDataPath / mName; + return GLOBAL_DATA_PATH; } std::vector LinuxPath::getInstallPaths() const