From 1b3b0b625afe3e36c92f956818e9d6b1e763d682 Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <github@naumov.de>
Date: Sat, 16 Jan 2021 15:39:08 +0100
Subject: [PATCH] [MaL] Use old-style target link libs for MKL.

This is partially reverting 071c19a9548dffdd58d5a715203ac908866f3ddd
"[CMake] Use generator expression for target_link_libraries()".

For the ninja build system when using shared libraries the
generator expressions produce erroneous build.ninja file, and
ninja generates an error:

```
CMake Error:
  Running

   '/usr/bin/ninja' '-C' '/home/naumov/w/ogs/r' '-t' 'recompact'

  failed with:

   ninja: error: build.ninja:8128: bad $-escape (literal $ must be written as $$)
```

Reason unknown.
---
 MathLib/CMakeLists.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/MathLib/CMakeLists.txt b/MathLib/CMakeLists.txt
index e5e1cd9c50e..d7e6f97f1c4 100644
--- a/MathLib/CMakeLists.txt
+++ b/MathLib/CMakeLists.txt
@@ -41,7 +41,6 @@ target_link_libraries(MathLib
         ${OpenMP_CXX_LIBRARIES}
         $<$<TARGET_EXISTS:LAPACK::LAPACK>:LAPACK::LAPACK>
         $<$<BOOL:${OGS_USE_LIS}>:${LIS_LIBRARIES}>
-        $<$<BOOL:${OGS_USE_MKL}>:${MKL_LIBRARIES}>
     PRIVATE
         spdlog::spdlog
 )
@@ -52,6 +51,9 @@ endif()
 if(OGS_USE_CVODE)
     target_link_libraries(MathLib PUBLIC ${CVODE_LIBRARIES})
 endif()
+if(OGS_USE_MKL)
+    target_link_libraries(MathLib PUBLIC ${MKL_LIBRARIES})
+endif()
 
 target_compile_definitions(MathLib
     PUBLIC
-- 
GitLab