From 7c7ffc5700530603356c267028c79d27b96cc852 Mon Sep 17 00:00:00 2001
From: Soeren Peters <peters@irmb.tu-bs.de>
Date: Fri, 1 Dec 2023 11:49:31 +0000
Subject: [PATCH] Remove CMP0105 policy.

---
 CMake/Sanitizers.cmake | 6 +++++-
 CMakeLists.txt         | 3 ---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/CMake/Sanitizers.cmake b/CMake/Sanitizers.cmake
index dedb07037..dbb3bc12c 100644
--- a/CMake/Sanitizers.cmake
+++ b/CMake/Sanitizers.cmake
@@ -49,7 +49,11 @@ function(enable_sanitizers project_name)
        "")
       message(STATUS "Enabling sanitizers: ${LIST_OF_SANITIZERS}")
       target_compile_options(${project_name} INTERFACE -fsanitize=${LIST_OF_SANITIZERS})
-      target_link_options(${project_name} INTERFACE -fsanitize=${LIST_OF_SANITIZERS})
+      
+      # From cmake 3.18 the LINK_OPTIONS and INTERFACE_LINK_OPTIONS target properties are now used for the device link step
+      # https://cmake.org/cmake/help/latest/release/3.18.html
+      # Thats why we are using a generator expression to only add the sanitizers to the host link step.
+      target_link_options(${project_name} INTERFACE "$<HOST_LINK:-fsanitize=$<JOIN:${LIST_OF_SANITIZERS},;>>")
     endif()
   endif()
 
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 813ba0600..688673f53 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,9 +29,6 @@
 
 cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
 
-# https://git.rz.tu-bs.de/irmb/VirtualFluids_dev/-/issues/154
-cmake_policy(SET CMP0105 OLD)
-
 project(
     VirtualFluids
     VERSION 0.1.0
-- 
GitLab