Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
unPERLifies a bit the routing: use the object, not its name
[simgrid.git] / CMakeLists.txt
index 1bcfc59..aa1e753 100644 (file)
@@ -121,7 +121,7 @@ string(REGEX MATCH "[0-9].[0-9]*" LINKER_VERSION "${LINKER_VERSION}")
 
 ### Set the library providing dlopen
 if("${CMAKE_SYSTEM}" MATCHES "Linux")
-  find_library(dl DL_LIBRARY)
+  find_library(DL_LIBRARY dl)
 endif("${CMAKE_SYSTEM}" MATCHES "Linux")
 
 ### Find programs and paths
@@ -334,6 +334,11 @@ else()
   set(HAVE_THREAD_LOCAL_STORAGE 0)
 endif()
 
+if(enable_model-checking AND NOT "${CMAKE_SYSTEM}" MATCHES "Linux")
+  message(WARNING "Support for model-checking has not been enabled on ${CMAKE_SYSTEM}: disabling it")
+  set(enable_model-checking FALSE)
+endif()
+
 if(HAVE_MMAP AND HAVE_THREAD_LOCAL_STORAGE)
   SET(HAVE_MMALLOC 1)
 else()
@@ -358,13 +363,22 @@ endif()
 
 include(FindLibunwind)
 if(HAVE_LIBUNWIND)
-  SET(SIMGRID_DEP "${SIMGRID_DEP} -lunwind -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(PROCESSOR_x86_64)
-    SET(SIMGRID_DEP "${SIMGRID_DEP} -lunwind-x86_64")
+  if(NOT APPLE)
+    SET(SIMGRID_DEP "${SIMGRID_DEP} -lunwind")
   else()
-    SET(SIMGRID_DEP "${SIMGRID_DEP} -lunwind-x86")
+    # 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")
+    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(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)
@@ -372,11 +386,6 @@ else()
   endif()
 endif()
 
-if(enable_model-checking AND NOT "${CMAKE_SYSTEM}" MATCHES "Linux")
-  message(WARNING "Support for model-checking has not been enabled on ${CMAKE_SYSTEM}: disabling it")
-  set(enable_model-checking FALSE)
-endif()
-
 if(enable_model-checking)
   SET(HAVE_MC 1)