diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2024-02-18 14:59:52 +0200 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2024-02-19 16:28:49 +0200 |
commit | 025eb6d7879e4c4e8cb29716b371e0f4c1aea660 (patch) | |
tree | a4e7d6e4f8bc3d82e49932f0cfda2c257d215253 | |
parent | CMake: Keep build working even if lib/*.[ch] are removed. (diff) | |
download | xz-025eb6d7879e4c4e8cb29716b371e0f4c1aea660.tar.xz |
CMake: Handle symbol versioning on MicroBlaze specially.
This is to match configure.ac.
-rw-r--r-- | CMakeLists.txt | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 79b6f95a..19ae4814 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1119,8 +1119,22 @@ if(WIN32) # Disable __declspec(dllimport) when linking against static liblzma. target_compile_definitions(liblzma INTERFACE LZMA_API_STATIC) endif() -elseif(BUILD_SHARED_LIBS AND CMAKE_SYSTEM_NAME STREQUAL "Linux") +elseif(BUILD_SHARED_LIBS AND CMAKE_SYSTEM_NAME STREQUAL "Linux" AND + NOT CMAKE_SYSTEM_PROCESSOR MATCHES "[Mm]icro[Bb]laze") # GNU/Linux-specific symbol versioning for shared liblzma. + # This includes a few extra compatibility symbols for RHEL/CentOS 7 + # which are pointless on non-glibc non-Linux systems. + # + # As a special case, GNU/Linux on MicroBlaze gets the generic + # symbol versioning because GCC 12 doesn't support the __symver__ + # attribute on MicroBlaze. On Linux, CMAKE_SYSTEM_PROCESSOR comes + # from "uname -m" for native builds (should be "microblaze") or from + # the CMake toolchain file (not perfectly standardized but it very + # likely has "microblaze" in lower case or mixed case somewhere in + # the string). + # + # FIXME? Avoid symvers on Linux with non-glibc like musl? + # # 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 @@ -1136,9 +1150,10 @@ elseif(BUILD_SHARED_LIBS AND CMAKE_SYSTEM_NAME STREQUAL "Linux") set_target_properties(liblzma PROPERTIES LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/liblzma/liblzma_linux.map" ) -elseif(BUILD_SHARED_LIBS AND CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") - # Symbol versioning for shared liblzma for non-GNU/Linux. - # FIXME? What about Solaris? +elseif(BUILD_SHARED_LIBS AND (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR + CMAKE_SYSTEM_NAME STREQUAL "Linux")) + # Generic symbol versioning for shared liblzma is used on FreeBSD and + # also on GNU/Linux on MicroBlaze. target_link_options(liblzma PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/src/liblzma/liblzma_generic.map" ) |