From f5b88ead7aff9cb9cc29cdc719dedd4f064a1aa6 Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Mon, 14 Dec 2020 13:46:23 +0100
Subject: [PATCH] [CMake] Moved definition USE_LIS.

---
 Applications/ApplicationsLib/CMakeLists.txt | 4 +++-
 CMakeLists.txt                              | 1 -
 MathLib/CMakeLists.txt                      | 3 +++
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/Applications/ApplicationsLib/CMakeLists.txt b/Applications/ApplicationsLib/CMakeLists.txt
index e391d9c34a3..1bcaaede239 100644
--- a/Applications/ApplicationsLib/CMakeLists.txt
+++ b/Applications/ApplicationsLib/CMakeLists.txt
@@ -4,7 +4,9 @@ set(LIB_SOURCES ${SOURCES_APPLICATIONSLIB})
 
 # Library
 ogs_add_library(ApplicationsLib ${LIB_SOURCES})
-
+if(USE_LIS)
+    target_compile_definitions(ApplicationsLib PUBLIC USE_LIS)
+endif()
 target_link_libraries(ApplicationsLib
                       PUBLIC BaseLib GeoLib NumLib Processes
                       PRIVATE CMakeInfoLib
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e55942b3026..f8fcd3ec0ef 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -186,7 +186,6 @@ option(OGS_USE_MFRONT
        OFF)
 # ---- Definitions ----
 if(OGS_USE_LIS)
-    add_definitions(-DUSE_LIS)
     include_directories(SYSTEM ${LIS_INCLUDE_DIR})
     set(OGS_USE_EIGEN ON)
 endif()
diff --git a/MathLib/CMakeLists.txt b/MathLib/CMakeLists.txt
index c5c74903922..d25681ac9d6 100644
--- a/MathLib/CMakeLists.txt
+++ b/MathLib/CMakeLists.txt
@@ -35,6 +35,9 @@ target_include_directories(MathLib
 )
 
 set_target_properties(MathLib PROPERTIES LINKER_LANGUAGE CXX)
+if(USE_LIS)
+    target_compile_definitions(MathLib PUBLIC USE_LIS)
+endif()
 
 target_link_libraries(MathLib
     PUBLIC
-- 
GitLab