aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2024-02-22 19:16:35 +0200
committerLasse Collin <lasse.collin@tukaani.org>2024-02-22 19:16:35 +0200
commit4c81c9611f8b2e1ad65eb7fa166afc570c58607e (patch)
treec9f5cc155c6a109b93cac794f581b0d2163ce23a
parentxz: Landlock: Fix error message if input file is a directory. (diff)
downloadxz-4c81c9611f8b2e1ad65eb7fa166afc570c58607e.tar.xz
CMake: Add LOCALEDIR to the windres workaround.
LOCALEDIR may contain spaces like in "C:\Program Files".
-rw-r--r--CMakeLists.txt16
1 files changed, 11 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b7047dc0..06282b4d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -158,6 +158,10 @@ set(CMAKE_C_STANDARD_REQUIRED ON)
# On Apple OSes, don't build executables as bundles:
set(CMAKE_MACOSX_BUNDLE OFF)
+# Set CMAKE_INSTALL_LIBDIR and friends. This needs to be done before
+# the LOCALEDIR_DEFINITION workaround below.
+include(GNUInstallDirs)
+
# windres from GNU binutils can be tricky with command line arguments
# that contain spaces or other funny characters. Unfortunately we need
# a space in PACKAGE_NAME. Using \x20 to encode the US-ASCII space seems
@@ -185,10 +189,15 @@ if((MINGW OR CYGWIN OR MSYS) AND (
# Keep the original PACKAGE_NAME intact for generation of liblzma.pc.
string(APPEND CMAKE_RC_FLAGS " --use-temp-file")
string(REPLACE " " "\\x20" PACKAGE_NAME_DEFINITION "${PACKAGE_NAME}")
+
+ # Use octal because "Program Files" would become \x20F.
+ string(REPLACE " " "\\040" LOCALEDIR_DEFINITION
+ "${CMAKE_INSTALL_FULL_LOCALEDIR}")
else()
# Elsewhere a space is safe. This also keeps things compatible with
# EBCDIC in case CMake-based build is ever done on such a system.
set(PACKAGE_NAME_DEFINITION "${PACKAGE_NAME}")
+ set(LOCALEDIR_DEFINITION "${CMAKE_INSTALL_FULL_LOCALEDIR}")
endif()
# Definitions common to all targets:
@@ -1306,9 +1315,6 @@ endif()
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/liblzma-config.cmake"
"${LZMA_CONFIG_CONTENTS}")
-# Set CMAKE_INSTALL_LIBDIR and friends.
-include(GNUInstallDirs)
-
# Create liblzma.pc.
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(exec_prefix "${CMAKE_INSTALL_PREFIX}")
@@ -1596,7 +1602,7 @@ if(HAVE_DECODERS AND (NOT MSVC OR MSVC_VERSION GREATER_EQUAL 1900))
target_compile_definitions(lzmainfo PRIVATE
ENABLE_NLS
PACKAGE="${TRANSLATION_DOMAIN}"
- LOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}"
+ LOCALEDIR="${LOCALEDIR_DEFINITION}"
)
endif()
@@ -1750,7 +1756,7 @@ if(NOT MSVC OR MSVC_VERSION GREATER_EQUAL 1900)
target_compile_definitions(xz PRIVATE
ENABLE_NLS
PACKAGE="${TRANSLATION_DOMAIN}"
- LOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}"
+ LOCALEDIR="${LOCALEDIR_DEFINITION}"
)
file(STRINGS po/LINGUAS LINGUAS)