llvm.org GIT mirror llvm / 11350ce
[CMake] Add support for NO_INSTALL_RPATH argument in llvm_add_library() Summary: Allow clients to suppress setup of default RPATHs in designated library targets. This is used in LLDB when emitting liblldb as a framework bundle, which itself doesn't load further RPATH-dependent libraries. This follows the approach in add_llvm_executable(). Reviewers: aprantl, JDevlieghere, davide, friss Reviewed By: aprantl Subscribers: mgorny, lldb-commits, llvm-commits, #lldb Differential Revision: https://reviews.llvm.org/D55316 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348573 91177308-0d34-0410-b5e6-96231b3b80d8 Stefan Granitz 10 months ago
1 changed file(s) with 9 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
371371 # May specify header files for IDE generators.
372372 # SONAME
373373 # Should set SONAME link flags and create symlinks
374 # NO_INSTALL_RPATH
375 # Suppress default RPATH settings in shared libraries.
374376 # PLUGIN_TOOL
375377 # The tool (i.e. cmake target) that this plugin will link against
376378 # )
377379 function(llvm_add_library name)
378380 cmake_parse_arguments(ARG
379 "MODULE;SHARED;STATIC;OBJECT;DISABLE_LLVM_LINK_LLVM_DYLIB;SONAME"
381 "MODULE;SHARED;STATIC;OBJECT;DISABLE_LLVM_LINK_LLVM_DYLIB;SONAME;NO_INSTALL_RPATH"
380382 "OUTPUT_NAME;PLUGIN_TOOL"
381383 "ADDITIONAL_HEADERS;DEPENDS;LINK_COMPONENTS;LINK_LIBS;OBJLIBS"
382384 ${ARGN})
447449
448450 if(ARG_MODULE)
449451 add_library(${name} MODULE ${ALL_FILES})
450 llvm_setup_rpath(${name})
451452 elseif(ARG_SHARED)
452453 add_windows_version_resource_file(ALL_FILES ${ALL_FILES})
453454 add_library(${name} SHARED ${ALL_FILES})
454
455 llvm_setup_rpath(${name})
456
457455 else()
458456 add_library(${name} STATIC ${ALL_FILES})
457 endif()
458
459 if(NOT ARG_NO_INSTALL_RPATH)
460 if(ARG_MODULE OR ARG_SHARED)
461 llvm_setup_rpath(${name})
462 endif()
459463 endif()
460464
461465 setup_dependency_debugging(${name} ${LLVM_COMMON_DEPENDS})