[llvm] r252669 - [cmake] move SONAME handling to llvm_add_library
Andrew Wilkins via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 10 15:19:21 PST 2015
Author: axw
Date: Tue Nov 10 17:19:21 2015
New Revision: 252669
URL: http://llvm.org/viewvc/llvm-project?rev=252669&view=rev
Log:
[cmake] move SONAME handling to llvm_add_library
Summary:
Move handling of the SONAME option from add_llvm_library
to llvm_add_library, so that it can be used in sub-projects.
In particular, this makes it possible to have consistently
named shared libraries for LLVM, Clang and LLDB.
Also, base the SONAME and symlinks on the output name
by extracting the OUTPUT_NAME property, rather than assuming
it is the same as the target name.
Reviewers: beanz
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D14539
Modified:
llvm/trunk/cmake/modules/AddLLVM.cmake
Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=252669&r1=252668&r2=252669&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
+++ llvm/trunk/cmake/modules/AddLLVM.cmake Tue Nov 10 17:19:21 2015
@@ -448,6 +448,24 @@ function(llvm_add_library name)
endif()
endif()
+ if(ARG_SHARED AND UNIX)
+ if(NOT APPLE AND ARG_SONAME)
+ get_target_property(output_name ${name} OUTPUT_NAME)
+ if(${output_name} STREQUAL "output_name-NOTFOUND")
+ set(output_name ${name})
+ endif()
+ set(library_name ${output_name}-${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}${LLVM_VERSION_SUFFIX})
+ set(api_name ${output_name}-${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX})
+ set_target_properties(${name} PROPERTIES OUTPUT_NAME ${library_name})
+ llvm_install_library_symlink(${api_name} ${library_name} SHARED
+ COMPONENT ${name}
+ ALWAYS_GENERATE)
+ llvm_install_library_symlink(${output_name} ${library_name} SHARED
+ COMPONENT ${name}
+ ALWAYS_GENERATE)
+ endif()
+ endif()
+
# Add the explicit dependency information for this library.
#
# It would be nice to verify that we have the dependencies for this library
@@ -498,7 +516,7 @@ endfunction()
macro(add_llvm_library name)
cmake_parse_arguments(ARG
- "SHARED;SONAME"
+ "SHARED"
""
""
${ARGN})
@@ -541,19 +559,6 @@ macro(add_llvm_library name)
-DCMAKE_INSTALL_COMPONENT=${name}
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
endif()
- if(ARG_SHARED AND UNIX)
- if(NOT APPLE AND ARG_SONAME)
- set(library_name ${name}-${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}${LLVM_VERSION_SUFFIX})
- set(api_name ${name}-${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX})
- set_target_properties(${name} PROPERTIES OUTPUT_NAME ${library_name})
- llvm_install_library_symlink(${api_name} ${library_name} SHARED
- COMPONENT ${name}
- ALWAYS_GENERATE)
- llvm_install_library_symlink(${name} ${library_name} SHARED
- COMPONENT ${name}
- ALWAYS_GENERATE)
- endif()
- endif()
endif()
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
endif()
More information about the llvm-commits
mailing list