Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
another try to fix mac OSX (libunwind is not the one we think there)
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 1 Nov 2016 19:38:55 +0000 (20:38 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 1 Nov 2016 19:38:55 +0000 (20:38 +0100)
tools/cmake/Modules/FindLibunwind.cmake

index 67bcde6..711f0ca 100644 (file)
@@ -15,20 +15,25 @@ if(PROCESSOR_x86_64)
 endif()
 
 if(NOT PATH_LIBUNWIND_LIB)
 endif()
 
 if(NOT PATH_LIBUNWIND_LIB)
-  find_library(PATH_LIBUNWIND_LIB
-    NAMES unwind
-    HINTS
-    $ENV{SIMGRID_LIBUNWIND_LIBRARY_PATH}
-    $ENV{LD_LIBRARY_PATH}
-    $ENV{LIBUNWIND_LIBRARY_PATH}
-    PATH_SUFFIXES lib/ GnuWin32/lib lib/system
-    PATHS
-    /opt
-    /opt/local
-    /opt/csw
-    /sw
-    /usr
-    /usr/lib/)
+  # Mac OSX has a libunwind that is not the one we need
+  CHECK_LIBRARY_EXISTS(unwind unw_init_local "Whether libunwind is usable" RIGHT_LIBUNWIND)
+
+  if (RIGHT_LIBUNWIND)
+    find_library(PATH_LIBUNWIND_LIB
+      NAMES unwind
+      HINTS
+      $ENV{SIMGRID_LIBUNWIND_LIBRARY_PATH}
+      $ENV{LD_LIBRARY_PATH}
+      $ENV{LIBUNWIND_LIBRARY_PATH}
+      PATH_SUFFIXES lib/ GnuWin32/lib lib/system
+      PATHS
+      /opt
+      /opt/local
+      /opt/csw
+      /sw
+      /usr
+      /usr/lib/)
+  endif()
 endif()
 
 find_path(PATH_LIBUNWIND_H "libunwind.h"
 endif()
 
 find_path(PATH_LIBUNWIND_H "libunwind.h"