From 60a93454d0eba6bd74cfe111633c2502ddebd725 Mon Sep 17 00:00:00 2001
From: Florent Pruvost <florent.pruvost@inria.fr>
Date: Fri, 30 Jan 2015 10:47:03 +0000
Subject: [PATCH] quark need threads to link

---
 cmake_modules/morse/find/FindQUARK.cmake | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/cmake_modules/morse/find/FindQUARK.cmake b/cmake_modules/morse/find/FindQUARK.cmake
index f2cc2d11b..ec94845c2 100644
--- a/cmake_modules/morse/find/FindQUARK.cmake
+++ b/cmake_modules/morse/find/FindQUARK.cmake
@@ -65,6 +65,10 @@ if( QUARK_FIND_COMPONENTS )
     endforeach()
 endif()
 
+if (NOT Threads_FOUND)
+    find_package(Threads REQUIRED)
+endif()
+
 # Looking for include
 # -------------------
 
@@ -186,7 +190,7 @@ endif ()
 if(QUARK_LIBRARIES)
     # check a function to validate the find
     set(CMAKE_REQUIRED_INCLUDES  "${QUARK_INCLUDE_DIRS}")
-    set(CMAKE_REQUIRED_LIBRARIES "${QUARK_LIBRARIES}")
+    set(CMAKE_REQUIRED_LIBRARIES "${QUARK_LIBRARIES};${CMAKE_THREAD_LIBS_INIT}")
     set(CMAKE_REQUIRED_FLAGS     "-L${QUARK_LIBRARY_DIRS}")
 
     unset(QUARK_WORKS CACHE)
@@ -194,7 +198,9 @@ if(QUARK_LIBRARIES)
     check_function_exists(QUARK_New QUARK_WORKS)
     mark_as_advanced(QUARK_WORKS)
 
-    if(NOT QUARK_WORKS)
+    if(QUARK_WORKS)
+        set(QUARK_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
+    else()
         if (QUARK_FIND_REQUIRED)
             if(NOT QUARK_FIND_QUIETLY)
                 message(STATUS "Looking for quark : test of QUARK_New with quark library fails")
-- 
GitLab