Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Revert "sanitize our way to find and load libunwind"
[simgrid.git] / CMakeLists.txt
index e22357c..961bd16 100644 (file)
@@ -378,17 +378,24 @@ else()
 endif()
 
 include(FindLibunwind)
-if(LIBUNWIND_FOUND)
+if(HAVE_LIBUNWIND)
   if(NOT APPLE)
-    foreach(lib ${LIBUNWIND_LIBRARIES})
-      SET(SIMGRID_DEP "${SIMGRID_DEP} ${lib}")
-    endforeach()
-    unset(lib)
+    SET(SIMGRID_DEP "${SIMGRID_DEP} -lunwind")
   else()
     # Apple forbids to link directly against its libunwind implementation
     # So let's comply and link against the System framework
     SET(SIMGRID_DEP "${SIMGRID_DEP} -lSystem")
   endif()
+  if("${CMAKE_SYSTEM}" MATCHES "Linux|FreeBSD")
+    set(SIMGRID_DEP "${SIMGRID_DEP} -lunwind-ptrace")
+    # This supposes that the host machine is either an AMD or a X86.
+    # This is deeply wrong, and should be fixed by manually loading -lunwind-PLAT (FIXME)
+    if(SIMGRID_PROCESSOR_x86_64)
+      SET(SIMGRID_DEP "${SIMGRID_DEP} -lunwind-x86_64")
+    else()
+      SET(SIMGRID_DEP "${SIMGRID_DEP} -lunwind-x86")
+    endif()
+  endif()
 else()
   if(enable_model-checking)
     message(FATAL_ERROR "Please install libunwind-dev libdw-dev libelf-dev libevent-dev if you want to compile the SimGrid model checker.")