[Openmp-commits] [openmp] r260300 - Have Mac builds use @rpath when supported in CMake

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Tue Feb 9 14:15:30 PST 2016


Author: jlpeyton
Date: Tue Feb  9 16:15:30 2016
New Revision: 260300

URL: http://llvm.org/viewvc/llvm-project?rev=260300&view=rev
Log:
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.

Modified:
    openmp/trunk/runtime/CMakeLists.txt
    openmp/trunk/runtime/tools/check-depends.pl

Modified: openmp/trunk/runtime/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/CMakeLists.txt?rev=260300&r1=260299&r2=260300&view=diff
==============================================================================
--- openmp/trunk/runtime/CMakeLists.txt (original)
+++ openmp/trunk/runtime/CMakeLists.txt Tue Feb  9 16:15:30 2016
@@ -112,6 +112,14 @@ set(LIBOMP_OSX_ARCHITECTURES "${CMAKE_OS
   "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.")

Modified: openmp/trunk/runtime/tools/check-depends.pl
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/tools/check-depends.pl?rev=260300&r1=260299&r2=260300&view=diff
==============================================================================
--- openmp/trunk/runtime/tools/check-depends.pl (original)
+++ openmp/trunk/runtime/tools/check-depends.pl Tue Feb  9 16:15:30 2016
@@ -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 );




More information about the Openmp-commits mailing list