[clang] Do not override libclang.so's SOVERSION if CLANG_FORCE_MATCHING_LIBCLANG_SOVE...
authorMichał Górny <mgorny@gentoo.org>
Tue, 11 Oct 2022 18:01:11 +0000 (20:01 +0200)
committerMichał Górny <mgorny@gentoo.org>
Wed, 12 Oct 2022 05:14:28 +0000 (07:14 +0200)
Instead of setting libclang.so's SOVERSION to CLANG_MAJOR_VERSION
when CLANG_FORCE_MATCHING_LIBCLANG_SOVERSION is enabled, do not override
it and let LLVM set the correct SOVERSION.  This fixes libclang.so
missing LLVM_VERSION_SUFFIX, and harmonizes the SOVERSION with other
shared libraries.

Differential Revision: https://reviews.llvm.org/D135701

clang/tools/libclang/CMakeLists.txt

index c6b3b44..3bfa78a 100644 (file)
@@ -9,10 +9,9 @@
 # TODO: This should probably not be a option going forward but we
 # we should commit to a way to do it. But due to getting this out
 # in LLVM 15.x we opted for a option.
+set(LIBCLANG_SOVERSION_ARG)
 if(NOT CLANG_FORCE_MATCHING_LIBCLANG_SOVERSION)
-  set(LIBCLANG_SOVERSION 13)
-else()
-  set(LIBCLANG_SOVERSION ${CLANG_VERSION_MAJOR})
+  set(LIBCLANG_SOVERSION_ARG SOVERSION 13)
 endif()
 
 # TODO: harmonize usage of LIBCLANG_SOVERSION / LIBCLANG_LIBARY_VERSION
@@ -195,7 +194,7 @@ if(ENABLE_SHARED)
 
     set_target_properties(libclang PROPERTIES
                           VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX}
-                          SOVERSION ${LIBCLANG_SOVERSION})
+                          ${LIBCLANG_SOVERSION_ARG})
   endif()
 endif()