From 0f496f1ed25a85d67709b25260aa304b901d0903 Mon Sep 17 00:00:00 2001 From: DS Date: Mon, 27 Mar 2023 20:02:48 +0200 Subject: [PATCH] Always build locale files in CMAKE_SOURCE_DIR if building RUN_IN_PLACE (#13272) --- cmake/Modules/FindGettextLib.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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//LC_MESSAGES) + # If the executable is expected to be ran from /bin/, also + # generate the locale in /locale/. + if(RUN_IN_PLACE AND NOT CMAKE_CROSSCOMPILING) + set(GETTEXT_MO_BUILD_PATH ${CMAKE_SOURCE_DIR}/locale//LC_MESSAGES) + else() + set(GETTEXT_MO_BUILD_PATH ${CMAKE_BINARY_DIR}/locale//LC_MESSAGES) + endif() set(GETTEXT_MO_DEST_PATH ${LOCALEDIR}//LC_MESSAGES) file(GLOB GETTEXT_AVAILABLE_LOCALES RELATIVE ${GETTEXT_PO_PATH} "${GETTEXT_PO_PATH}/*") list(REMOVE_ITEM GETTEXT_AVAILABLE_LOCALES minetest.pot)