From 9c86848003d4afae78da6c02d5b4e5fc7721a066 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Tue, 1 Nov 2016 20:38:55 +0100 Subject: [PATCH] another try to fix mac OSX (libunwind is not the one we think there) --- tools/cmake/Modules/FindLibunwind.cmake | 33 ++++++++++++++----------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/tools/cmake/Modules/FindLibunwind.cmake b/tools/cmake/Modules/FindLibunwind.cmake index 67bcde67ae..711f0ca1f3 100644 --- a/tools/cmake/Modules/FindLibunwind.cmake +++ b/tools/cmake/Modules/FindLibunwind.cmake @@ -15,20 +15,25 @@ if(PROCESSOR_x86_64) 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" -- 2.20.1