mirror of https://git.tukaani.org/xz.git
CMake: Add the resource files to the Cygwin and MSYS2 builds
Autotools-based build has always done this so this is for consistency. However, the CMake build won't create the DEF file when building for Cygwin or MSYS2 because in that context it should be useless. (If Cygwin or MSYS2 is used to host building of normal Windows binaries then the DEF file is still created.)
This commit is contained in:
parent
da4f275bd1
commit
c3b9dad07d
|
@ -1370,7 +1370,7 @@ else()
|
||||||
target_compile_definitions(liblzma PRIVATE HAVE_VISIBILITY=0)
|
target_compile_definitions(liblzma PRIVATE HAVE_VISIBILITY=0)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32 OR CYGWIN)
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
# 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)
|
||||||
|
@ -1382,8 +1382,12 @@ if(WIN32)
|
||||||
# Export the public API symbols with __declspec(dllexport).
|
# Export the public API symbols with __declspec(dllexport).
|
||||||
target_compile_definitions(liblzma PRIVATE DLL_EXPORT)
|
target_compile_definitions(liblzma PRIVATE DLL_EXPORT)
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC AND NOT CYGWIN)
|
||||||
# Create a DEF file. The linker puts the ordinal numbers there
|
# Create a DEF file. The Autotools-based build creates a DEF file
|
||||||
|
# under Cygwin & MSYS2 too but it almost certainly is a useless
|
||||||
|
# file in that context, so the CMake build omits it.
|
||||||
|
#
|
||||||
|
# The linker puts the ordinal numbers in the DEF file
|
||||||
# too so the output from the linker isn't our final file.
|
# too so the output from the linker isn't our final file.
|
||||||
target_link_options(liblzma PRIVATE
|
target_link_options(liblzma PRIVATE
|
||||||
"-Wl,--output-def,liblzma.def.in")
|
"-Wl,--output-def,liblzma.def.in")
|
||||||
|
@ -1848,7 +1852,7 @@ if(HAVE_DECODERS)
|
||||||
|
|
||||||
target_link_libraries("${XZDEC}" PRIVATE liblzma libgnu)
|
target_link_libraries("${XZDEC}" PRIVATE liblzma libgnu)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32 OR CYGWIN)
|
||||||
# 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_source_files_properties(
|
set_source_files_properties(
|
||||||
|
@ -1917,7 +1921,7 @@ if(XZ_TOOL_LZMAINFO AND HAVE_DECODERS)
|
||||||
|
|
||||||
target_link_libraries(lzmainfo PRIVATE liblzma libgnu)
|
target_link_libraries(lzmainfo PRIVATE liblzma libgnu)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32 OR CYGWIN)
|
||||||
# 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_source_files_properties(src/lzmainfo/lzmainfo_w32res.rc PROPERTIES
|
set_source_files_properties(src/lzmainfo/lzmainfo_w32res.rc PROPERTIES
|
||||||
|
@ -2030,7 +2034,7 @@ if(XZ_TOOL_XZ)
|
||||||
this many MiB of RAM if xz cannot determine the amount at runtime")
|
this many MiB of RAM if xz cannot determine the amount at runtime")
|
||||||
target_compile_definitions(xz PRIVATE "ASSUME_RAM=${XZ_ASSUME_RAM}")
|
target_compile_definitions(xz PRIVATE "ASSUME_RAM=${XZ_ASSUME_RAM}")
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32 OR CYGWIN)
|
||||||
# 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_source_files_properties(src/xz/xz_w32res.rc PROPERTIES
|
set_source_files_properties(src/xz/xz_w32res.rc PROPERTIES
|
||||||
|
|
Loading…
Reference in New Issue