diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2022-09-08 15:02:41 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2022-09-08 15:02:41 +0300 |
commit | 17485e884ce5c74315f29a8a1507bc706cd5cd1d (patch) | |
tree | fbd08f50c760e6512fbb0acdaac0e6f6ceb08ee0 | |
parent | liblzma: Vaccinate against an ill patch from RHEL/CentOS 7. (diff) | |
download | xz-17485e884ce5c74315f29a8a1507bc706cd5cd1d.tar.xz |
CMake: Update for liblzma_*.map files and fix wrong common_w32res.rc dep.
The previous commit split liblzma.map into liblzma_linux.map and
liblzma_generic.map. This commit updates the CMake build for those.
common_w32res.rc dependency was listed under Linux/FreeBSD while
obviously it belongs to Windows when building a DLL.
-rw-r--r-- | CMakeLists.txt | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 14b5adc7..7ac8ecbc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -417,20 +417,34 @@ if(WIN32) # Add the Windows resource file for liblzma.dll. target_sources(liblzma PRIVATE src/liblzma/liblzma_w32res.rc) + set_target_properties(liblzma PROPERTIES + LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/common/common_w32res.rc" + ) + # Export the public API symbols with __declspec(dllexport). target_compile_definitions(liblzma PRIVATE DLL_EXPORT) else() # Disable __declspec(dllimport) when linking against static liblzma. target_compile_definitions(liblzma INTERFACE LZMA_API_STATIC) endif() -elseif(CMAKE_SYSTEM_NAME MATCHES "^Linux$|^FreeBSD$") - # Symbol versioning for shared liblzma. This doesn't affect static builds. +elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") + # GNU/Linux-specific symbol versioning for shared liblzma. + # Note that adding link options doesn't affect static builds. + target_compile_definitions(liblzma PRIVATE HAVE_SYMBOL_VERSIONS_LINUX) + target_link_options(liblzma PRIVATE + "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/src/liblzma/liblzma_linux.map" + ) + set_target_properties(liblzma PROPERTIES + LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/liblzma/liblzma_linux.map" + ) +elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + # Symbol versioning for shared liblzma for non-GNU/Linux. + # FIXME? What about Solaris? target_link_options(liblzma PRIVATE - "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/src/liblzma/liblzma.map" + "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/src/liblzma/liblzma_generic.map" ) set_target_properties(liblzma PROPERTIES - LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/liblzma/liblzma.map" - LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/common/common_w32res.rc" + LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/liblzma/liblzma_generic.map" ) endif() |