forked from OSchip/llvm-project
Have Mac builds use @rpath when supported in CMake
The -install_name linker flag will use "@rpath/" when supported in CMake which is the recommended usage for dynamic libraries on Mac OSX. llvm-svn: 260300
This commit is contained in:
parent
36ab260b0d
commit
89d9b333b0
openmp/runtime
|
@ -112,6 +112,14 @@ set(LIBOMP_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}" CACHE STRING
|
|||
"For Mac builds, semicolon separated list of architectures to build for universal fat binary.")
|
||||
set(CMAKE_OSX_ARCHITECTURES ${LIBOMP_OSX_ARCHITECTURES})
|
||||
|
||||
# Should @rpath be used for dynamic libraries on Mac?
|
||||
# The if(NOT DEFINED) is there to guard a cached value of the variable if one
|
||||
# exists so there is no interference with what the user wants. Also, no cache entry
|
||||
# is created so there are no inadvertant effects on other parts of LLVM.
|
||||
if(NOT DEFINED CMAKE_MACOSX_RPATH)
|
||||
set(CMAKE_MACOSX_RPATH TRUE)
|
||||
endif()
|
||||
|
||||
# User specified flags. These are appended to the configured flags.
|
||||
set(LIBOMP_CFLAGS "" CACHE STRING
|
||||
"Appended user specified C compiler flags.")
|
||||
|
|
|
@ -185,6 +185,8 @@ sub get_deps_otool($) {
|
|||
or parse_error( $tool, @bulk, $i );
|
||||
++ $i;
|
||||
if ( $name =~ m{\.dylib\z} ) {
|
||||
# Added "@rpath/" enables dynamic load of the library designated at link time.
|
||||
$name = '@rpath/' . $name;
|
||||
# In case of dynamic library otool print the library itself as a dependent library.
|
||||
( $i < @bulk and $bulk[ $i ] =~ m{^\s+\Q$name\E\s+\(compatibility version.*\)$} )
|
||||
or parse_error( $tool, @bulk, $i );
|
||||
|
|
Loading…
Reference in New Issue