From 4881ce67c1bbbd976dc8d23046c99b968a08826a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Keith=20Fran=C3=A7ois?= <keith@lirmm.fr>
Date: Thu, 18 Oct 2012 16:51:20 +0200
Subject: [PATCH] MacOSX compatibility: avoid dangerous TARGET_LINK_LIBRARIES

This crashes the linkage because of the particular link
with the frameworks (here the framework Acceleration).
---
 src/CMakeLists.txt   | 5 ++++-
 tests/CMakeLists.txt | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ac8e45d..c912f90 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -57,7 +57,10 @@ IF (UNIX)
 ENDIF (UNIX)
 
 TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${Boost_LIBRARIES})
-TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${JRL_MAL_LDFLAGS_OTHER})
+
+IF (UNIX AND NOT APPLE)
+  TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${JRL_MAL_LDFLAGS_OTHER})
+ENDIF (UNIX AND NOT APPLE)
 
 INSTALL(TARGETS ${LIBRARY_NAME}
   DESTINATION lib)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index aa07ef2..723b69b 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -46,7 +46,9 @@ MACRO(DYNAMIC_GRAPH_TEST NAME)
   # Search for jrl-mal.
   INCLUDE_DIRECTORIES(${JRL_MAL_INCLUDE_DIRS})
   LINK_DIRECTORIES(${JRL_MAL_LIBRARY_DIRS})
-  TARGET_LINK_LIBRARIES(${NAME} ${JRL_MAL_LDFLAGS})
+  IF(UNIX AND NOT APPLE)
+    TARGET_LINK_LIBRARIES(${NAME} ${JRL_MAL_LDFLAGS})
+  ENDIF(UNIX AND NOT APPLE)
 ENDMACRO(DYNAMIC_GRAPH_TEST)
 
 
-- 
GitLab