]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
CMake/Windows: Add resource files to xz.exe and xzdec.exe.
authorLasse Collin <lasse.collin@tukaani.org>
Sat, 7 Jan 2023 17:50:03 +0000 (19:50 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Sat, 11 Mar 2023 19:34:26 +0000 (21:34 +0200)
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.

CMakeLists.txt

index 84dd8edb1993580c2ab40ccbf7cdf8a71bc5d7fa..d91eb4ca0d48cef04fdebe0f1f0b2409f8030335 100644 (file)
@@ -565,6 +565,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
@@ -636,6 +644,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)