[PATCH] D14040: [CMake] make name of libLLVM configurable
Andrew Wilkins via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 30 03:02:01 PDT 2015
axw updated this revision to Diff 38790.
axw added a comment.
- Drop LLVM_DYLIB_NAME changes
- Use "cmake-default" as the magic string to not set any SOVERSION/VERSION property
http://reviews.llvm.org/D14040
Files:
CMakeLists.txt
cmake/modules/AddLLVM.cmake
tools/llvm-shlib/CMakeLists.txt
Index: tools/llvm-shlib/CMakeLists.txt
===================================================================
--- tools/llvm-shlib/CMakeLists.txt
+++ tools/llvm-shlib/CMakeLists.txt
@@ -72,7 +72,11 @@
add_custom_target(libLLVMExports DEPENDS ${LLVM_EXPORTED_SYMBOL_FILE})
endif()
-add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB ${SOURCES})
+add_llvm_library(LLVM ${SOURCES}
+ SHARED
+ SOVERSION ${LLVM_DYLIB_SOVERSION}
+ VERSION ${LLVM_DYLIB_VERSION}
+ DISABLE_LLVM_LINK_LLVM_DYLIB)
list(REMOVE_DUPLICATES LIB_NAMES)
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") # FIXME: It should be "GNU ld for elf"
Index: cmake/modules/AddLLVM.cmake
===================================================================
--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -326,7 +326,7 @@
function(llvm_add_library name)
cmake_parse_arguments(ARG
"MODULE;SHARED;STATIC;DISABLE_LLVM_LINK_LLVM_DYLIB"
- "OUTPUT_NAME"
+ "OUTPUT_NAME;SOVERSION;VERSION"
"ADDITIONAL_HEADERS;DEPENDS;LINK_COMPONENTS;LINK_LIBS;OBJLIBS"
${ARGN})
list(APPEND LLVM_COMMON_DEPENDS ${ARG_DEPENDS})
@@ -431,10 +431,25 @@
)
endif()
- set_target_properties(${name}
- PROPERTIES
- SOVERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}
- VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX})
+ # Set SOVERSION iff it is unspecified in arguments;
+ # we take a value of "cmake-default" to mean don't
+ # set the property.
+ set(soversion ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR})
+ if(ARG_SOVERSION)
+ set(soversion ${ARG_SOVERSION})
+ endif()
+ if(NOT "${soversion}" STREQUAL "cmake-default")
+ set_target_properties(${name} PROPERTIES SOVERSION ${soversion})
+ endif()
+
+ # As above, but for VERSION.
+ set(version ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX})
+ if(ARG_VERSION)
+ set(version ${ARG_VERSION})
+ endif()
+ if(NOT "${version}" STREQUAL "cmake-default")
+ set_target_properties(${name} PROPERTIES VERSION ${version})
+ endif()
endif()
if(ARG_MODULE OR ARG_SHARED)
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -366,6 +366,11 @@
option (LLVM_BUILD_EXTERNAL_COMPILER_RT
"Build compiler-rt as an external project." OFF)
+set(LLVM_DYLIB_SOVERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}" CACHE STRING
+ "Specify the SOVERSION for libLLVM (specify \"cmake-default\" to use the CMake default)")
+set(LLVM_DYLIB_VERSION "${PACKAGE_VERSION}" CACHE STRING
+ "Specify the VERSION for libLLVM (specify \"cmake-default\" to use the CMake default)")
+
# You can configure which libraries from LLVM you want to include in the
# shared library by setting LLVM_DYLIB_COMPONENTS to a semi-colon delimited
# list of LLVM components. All component names handled by llvm-config are valid.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14040.38790.patch
Type: text/x-patch
Size: 3000 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151030/3ef85883/attachment.bin>
More information about the llvm-commits
mailing list