aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt24
1 files changed, 19 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cf42055c..90939c2b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -414,20 +414,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()