1
0
Fork 0
mirror of https://git.tukaani.org/xz.git synced 2024-04-04 12:36:23 +02:00

CMake/Windows: Add a workaround for windres from GNU binutils.

Thanks to Iouri Kharon for the bug report and the original patch.
This commit is contained in:
Lasse Collin 2023-01-07 19:48:52 +02:00
parent ceb8050117
commit 443dfebced

View file

@ -75,10 +75,29 @@ project(xz VERSION "${XZ_VERSION}" LANGUAGES C)
# On Apple OSes, don't build executables as bundles: # On Apple OSes, don't build executables as bundles:
set(CMAKE_MACOSX_BUNDLE OFF) 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: # Definitions common to all targets:
add_compile_definitions( add_compile_definitions(
# Package info: # Package info:
PACKAGE_NAME="XZ Utils" PACKAGE_NAME="${PACKAGE_NAME}"
PACKAGE_BUGREPORT="xz@tukaani.org" PACKAGE_BUGREPORT="xz@tukaani.org"
PACKAGE_URL="https://tukaani.org/xz/" PACKAGE_URL="https://tukaani.org/xz/"