From c95fe74e35fd3b2e6a0e29aa15b650923ccbb7dc Mon Sep 17 00:00:00 2001
From: Martin Beseda <martin.beseda@vsb.cz>
Date: Thu, 21 Feb 2019 04:22:58 +0100
Subject: [PATCH] FIX: trying to fix CI...

---
 CMakeLists.txt         |  2 +-
 DownloadOpenBLAS.cmake | 11 ++++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d7bd725b..4be8ab7a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.11)
+cmake_minimum_required(VERSION 3.12)
 project(lib4neuro)
 
 message("Using CMake ${CMAKE_VERSION}")
diff --git a/DownloadOpenBLAS.cmake b/DownloadOpenBLAS.cmake
index 57e669c7..ac640f14 100644
--- a/DownloadOpenBLAS.cmake
+++ b/DownloadOpenBLAS.cmake
@@ -20,6 +20,11 @@ FetchContent_Populate(OpenBLAS)
 ##################
 # Build OpenBLAS #
 ##################
+
+# Add a compile flag -lgfortran and -lpthreads
+set(OLD_CMAKE_EXE_LINKER_FLAGS  ${CMAKE_EXE_LINKER_FLAGS})
+set(CMAKE_EXE_LINKER_FLAGS  "${CMAKE_EXE_LINKER_FLAGS} -lgfortran -lpthread")
+
 execute_process(
     COMMAND cmake -j ${N_CORES} .
     WORKING_DIRECTORY ${OPENBLAS_LOCAL_PATH}
@@ -29,9 +34,6 @@ if(NOT rv STREQUAL "0")
     message("OpenBLAS build: cmake .: ${rv}")
 endif()
 
-# Add a compile flag -lgfortran and -lpthreads
-set_target_properties(openblas PROPERTIES LINK_FLAGS "-lgfortran -lpthreads")
-
 # Build library
 execute_process(
     COMMAND cmake --build . -j ${N_CORES} --config Release
@@ -42,6 +44,9 @@ if(NOT rv STREQUAL "0")
     message("OpenBLAS build: cmake --build . -j ${N_CORES}: ${rv}")
 endif()
 
+# Remove link flags
+set(CMAKE_EXE_LINKER_FLAGS ${OLD_CMAKE_EXE_LINKER_FLAGS})
+
 set(OpenBLAS_DIR ${CMAKE_CURRENT_LIST_DIR}/external_dependencies/OpenBLAS)
 find_package(OpenBLAS)
 
-- 
GitLab