diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2022-11-24 00:02:31 +0200 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2022-11-24 23:50:46 +0200 |
commit | 6c29793b3cac292b25801d011db6d8ccade50396 (patch) | |
tree | 383a134226eeb806196b9111c0523a889ea364ad | |
parent | liblzma: Fix another invalid free() after memory allocation failure. (diff) | |
download | xz-6c29793b3cac292b25801d011db6d8ccade50396.tar.xz |
CMake: Don't use symbol versioning with static library.
Diffstat (limited to '')
-rw-r--r-- | CMakeLists.txt | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 62d349ae..8288d933 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -424,9 +424,13 @@ if(WIN32) # Disable __declspec(dllimport) when linking against static liblzma. target_compile_definitions(liblzma INTERFACE LZMA_API_STATIC) endif() -elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") +elseif(BUILD_SHARED_LIBS AND CMAKE_SYSTEM_NAME STREQUAL "Linux") # GNU/Linux-specific symbol versioning for shared liblzma. - # Note that adding link options doesn't affect static builds. + # Note that adding link options doesn't affect static builds + # but HAVE_SYMBOL_VERSIONS_LINUX must not be used with static builds + # because it would put symbol versions into the static library which + # can cause problems. It's clearer if all symver related things are + # omitted when not building a shared library. 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" @@ -434,7 +438,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") set_target_properties(liblzma PROPERTIES LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/liblzma/liblzma_linux.map" ) -elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") +elseif(BUILD_SHARED_LIBS AND CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") # Symbol versioning for shared liblzma for non-GNU/Linux. # FIXME? What about Solaris? target_link_options(liblzma PRIVATE |