aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2023-01-07 19:48:52 +0200
committerLasse Collin <lasse.collin@tukaani.org>2023-01-08 00:20:42 +0200
commit443dfebced041adc88f10d824188eeef5b5821a9 (patch)
treec13f62fb44ac7464187d8c199d12a4edc328ad64 /CMakeLists.txt
parentBuild: Require that _mm_set_epi64x() is usable to enable CLMUL support. (diff)
downloadxz-443dfebced041adc88f10d824188eeef5b5821a9.tar.xz
CMake/Windows: Add a workaround for windres from GNU binutils.
Thanks to Iouri Kharon for the bug report and the original patch.
Diffstat (limited to '')
-rw-r--r--CMakeLists.txt21
1 files changed, 20 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ef17563e..2a6fc388 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -75,10 +75,29 @@ project(xz VERSION "${XZ_VERSION}" LANGUAGES C)
# On Apple OSes, don't build executables as bundles:
set(CMAKE_MACOSX_BUNDLE OFF)
+# String for PACKAGE_NAME macro in the C code and Windows resource files:
+#
+# windres from GNU binutils can be a bit tricky with command line arguments
+# that contain spaces or other funny characters because it will pass them
+# to a shell (cmd.exe or /bin/sh). CMake doesn't seem to handle the quoting
+# well enough either. Using \x20 to encode the US-ASCII space seems to work:
+# it should be compatible with both shell types, it works also with llvm-rc,
+# and CMake handles quoting the backslash too.
+#
+# For simplicity, use this workaround in all cases on Windows as it should
+# do no harm with other toolchains. Outside Windows use a regular space as
+# then we are compatible with EBCDIC too (if it will ever matter with CMake;
+# EBCDIC compatibility is important with the Autotools-based build though).
+if(WIN32)
+ set(PACKAGE_NAME "XZ\\x20Utils")
+else()
+ set(PACKAGE_NAME "XZ Utils")
+endif()
+
# Definitions common to all targets:
add_compile_definitions(
# Package info:
- PACKAGE_NAME="XZ Utils"
+ PACKAGE_NAME="${PACKAGE_NAME}"
PACKAGE_BUGREPORT="xz@tukaani.org"
PACKAGE_URL="https://tukaani.org/xz/"