From 8d19542bae444feaf99829e75c3e77a1c5a47e6b Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Thu, 28 May 2020 10:56:54 +0200
Subject: [PATCH] [CMake] Check header fix for non-existing targets.

---
 scripts/cmake/CheckHeaderCompilation.cmake | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/cmake/CheckHeaderCompilation.cmake b/scripts/cmake/CheckHeaderCompilation.cmake
index a36092feba4..addb233a92c 100644
--- a/scripts/cmake/CheckHeaderCompilation.cmake
+++ b/scripts/cmake/CheckHeaderCompilation.cmake
@@ -15,6 +15,10 @@ add_custom_target(check-header
 # Checks header for standalone compilation
 function(_check_header_compilation TARGET)
 
+    if(NOT TARGET ${TARGET})
+        return()
+    endif()
+
     get_target_property(SOURCE_FILES ${TARGET} SOURCES)
     get_target_property(SOURCE_DIR ${TARGET} SOURCE_DIR)
 
-- 
GitLab