aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDS <ds.desour@proton.me>2023-03-27 20:02:48 +0200
committerGitHub <noreply@github.com>2023-03-27 20:02:48 +0200
commit0f496f1ed25a85d67709b25260aa304b901d0903 (patch)
tree1e49288f95da0d33089182b03a30ae7f98b0c655
parentea095d3f69e7aadbcdbe5294e5dfc42ba2fe93bf (diff)
downloadminetest-0f496f1ed25a85d67709b25260aa304b901d0903.tar.xz
Always build locale files in CMAKE_SOURCE_DIR if building RUN_IN_PLACE (#13272)
-rw-r--r--cmake/Modules/FindGettextLib.cmake8
1 files changed, 7 insertions, 1 deletions
diff --git a/cmake/Modules/FindGettextLib.cmake b/cmake/Modules/FindGettextLib.cmake
index 4aacc9a40..0052d6578 100644
--- a/cmake/Modules/FindGettextLib.cmake
+++ b/cmake/Modules/FindGettextLib.cmake
@@ -32,7 +32,13 @@ find_package_handle_standard_args(GettextLib DEFAULT_MSG ${GETTEXT_REQUIRED_VARS
if(GETTEXTLIB_FOUND)
# Set up paths for building
set(GETTEXT_PO_PATH ${CMAKE_SOURCE_DIR}/po)
- set(GETTEXT_MO_BUILD_PATH ${CMAKE_BINARY_DIR}/locale/<locale>/LC_MESSAGES)
+ # If the executable is expected to be ran from <source dir>/bin/, also
+ # generate the locale in <source dir>/locale/.
+ if(RUN_IN_PLACE AND NOT CMAKE_CROSSCOMPILING)
+ set(GETTEXT_MO_BUILD_PATH ${CMAKE_SOURCE_DIR}/locale/<locale>/LC_MESSAGES)
+ else()
+ set(GETTEXT_MO_BUILD_PATH ${CMAKE_BINARY_DIR}/locale/<locale>/LC_MESSAGES)
+ endif()
set(GETTEXT_MO_DEST_PATH ${LOCALEDIR}/<locale>/LC_MESSAGES)
file(GLOB GETTEXT_AVAILABLE_LOCALES RELATIVE ${GETTEXT_PO_PATH} "${GETTEXT_PO_PATH}/*")
list(REMOVE_ITEM GETTEXT_AVAILABLE_LOCALES minetest.pot)