aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2023-01-07 19:50:03 +0200
committerLasse Collin <lasse.collin@tukaani.org>2023-01-08 00:20:42 +0200
commit6e38e595dd56ac1800478cef1f6f754d0eba0d2e (patch)
treef644c5667ec4473ba35f681e140e77642355d082 /CMakeLists.txt
parentCMake/Windows: Add a workaround for windres from GNU binutils. (diff)
downloadxz-6e38e595dd56ac1800478cef1f6f754d0eba0d2e.tar.xz
CMake/Windows: Add resource files to xz.exe and xzdec.exe.
The command line tools cannot be built with MSVC for now but they can be built with MinGW-w64. Thanks to Iouri Kharon for the bug report and the original patch.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt16
1 files changed, 16 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2a6fc388..00a645f8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -630,6 +630,14 @@ if(HAVE_GETOPT_LONG)
target_link_libraries(xzdec PRIVATE liblzma)
+ if(WIN32)
+ # Add the Windows resource file for xzdec.exe.
+ target_sources(xz PRIVATE src/xzdec/xzdec_w32res.rc)
+ set_target_properties(xz PROPERTIES
+ LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/common/common_w32res.rc"
+ )
+ endif()
+
tuklib_progname(xzdec)
install(TARGETS xzdec
@@ -701,6 +709,14 @@ if(NOT MSVC AND HAVE_GETOPT_LONG)
target_compile_definitions(xz PRIVATE ASSUME_RAM=128)
+ if(WIN32)
+ # Add the Windows resource file for xz.exe.
+ target_sources(xz PRIVATE src/xz/xz_w32res.rc)
+ set_target_properties(xz PROPERTIES
+ LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/common/common_w32res.rc"
+ )
+ endif()
+
tuklib_progname(xz)
tuklib_mbstr(xz)