CMake: Fix Windows resource file dependencies

If common_w32res.rc is modified, the resource files need to be rebuilt.
In contrast, the liblzma*.map files truly are link dependencies.
This commit is contained in:
Lasse Collin 2024-09-28 15:19:14 +03:00
parent 1c673c0aac
commit da4f275bd1
1 changed files with 9 additions and 8 deletions

View File

@ -1375,8 +1375,8 @@ if(WIN32)
# Add the Windows resource file for liblzma.dll. # Add the Windows resource file for liblzma.dll.
target_sources(liblzma PRIVATE src/liblzma/liblzma_w32res.rc) target_sources(liblzma PRIVATE src/liblzma/liblzma_w32res.rc)
set_target_properties(liblzma PROPERTIES set_source_files_properties(src/liblzma/liblzma_w32res.rc PROPERTIES
LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/common/common_w32res.rc" OBJECT_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/common/common_w32res.rc"
) )
# Export the public API symbols with __declspec(dllexport). # Export the public API symbols with __declspec(dllexport).
@ -1851,8 +1851,9 @@ if(HAVE_DECODERS)
if(WIN32) if(WIN32)
# Add the Windows resource file for xzdec.exe or lzmadec.exe. # Add the Windows resource file for xzdec.exe or lzmadec.exe.
target_sources("${XZDEC}" PRIVATE "src/xzdec/${XZDEC}_w32res.rc") target_sources("${XZDEC}" PRIVATE "src/xzdec/${XZDEC}_w32res.rc")
set_target_properties("${XZDEC}" PROPERTIES set_source_files_properties(
LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/common/common_w32res.rc" "src/xzdec/${XZDEC}_w32res.rc" PROPERTIES
OBJECT_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/common/common_w32res.rc"
) )
endif() endif()
@ -1919,8 +1920,8 @@ if(XZ_TOOL_LZMAINFO AND HAVE_DECODERS)
if(WIN32) if(WIN32)
# Add the Windows resource file for lzmainfo.exe. # Add the Windows resource file for lzmainfo.exe.
target_sources(lzmainfo PRIVATE src/lzmainfo/lzmainfo_w32res.rc) target_sources(lzmainfo PRIVATE src/lzmainfo/lzmainfo_w32res.rc)
set_target_properties(lzmainfo PROPERTIES set_source_files_properties(src/lzmainfo/lzmainfo_w32res.rc PROPERTIES
LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/common/common_w32res.rc" OBJECT_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/common/common_w32res.rc"
) )
endif() endif()
@ -2032,8 +2033,8 @@ this many MiB of RAM if xz cannot determine the amount at runtime")
if(WIN32) if(WIN32)
# Add the Windows resource file for xz.exe. # Add the Windows resource file for xz.exe.
target_sources(xz PRIVATE src/xz/xz_w32res.rc) target_sources(xz PRIVATE src/xz/xz_w32res.rc)
set_target_properties(xz PROPERTIES set_source_files_properties(src/xz/xz_w32res.rc PROPERTIES
LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/common/common_w32res.rc" OBJECT_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/common/common_w32res.rc"
) )
endif() endif()