From 9b815cf9d66a6976d16c84ccf632b442cb08105e Mon Sep 17 00:00:00 2001
From: Martin Beseda <martin.beseda@vsb.cz>
Date: Thu, 21 Feb 2019 12:43:18 +0100
Subject: [PATCH] FIX: Trying to fix CI...

---
 CMakeLists.txt         |  4 ++--
 DownloadOpenBLAS.cmake |  3 +++
 src/CMakeLists.txt     | 11 +++++++++++
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f75d355f..d4f97f5b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -155,8 +155,8 @@ endif()
 
 if(NOT WIN32)
     message("Checking Armadillo dependencies")
-    find_package(LAPACK)
-    find_package(BLAS)
+#    find_package(LAPACK)
+#    find_package(BLAS)
 
     set(ARMA_LIBS "")
     if(NOT LAPACK_FOUND AND NOT BLAS_FOUND)
diff --git a/DownloadOpenBLAS.cmake b/DownloadOpenBLAS.cmake
index 9a5bae51..4f207c80 100644
--- a/DownloadOpenBLAS.cmake
+++ b/DownloadOpenBLAS.cmake
@@ -42,6 +42,9 @@ if(NOT rv STREQUAL "0")
     message("OpenBLAS build: cmake --build: ${rv}")
 endif()
 
+set_target_properties(openblas PROPERTIES LINK_FLAGS)
+add_subdirectory(${OPENBLAS_LOCAL_PATH})
+
 find_package(OpenBLAS)
 
 if(NOT OpenBLAS_FOUND)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a2389672..5fcf9992 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -69,6 +69,15 @@ if ("${BUILD_LIB}" STREQUAL "yes")
         set(CXX_FILESYSTEM_LIB "stdc++fs")
     endif ()
 
+    # Detect Threading library
+    set(THREADS_PREFER_PTHREAD_FLAG ON)
+    find_package(Threads REQUIRED)
+
+    set(GFORT "")
+    if(NOT WIN32)
+        set(GFORT gfortran)
+    endif()
+
     target_link_libraries(
         lib4neuro
 
@@ -77,6 +86,8 @@ if ("${BUILD_LIB}" STREQUAL "yes")
         ${Boost_LIBRARIES}
         ${CXX_FILESYSTEM_LIB}
         armadillo
+        Threads::Threads
+        ${GFORT}
     )
 
     target_include_directories(
-- 
GitLab