From 216793febb59b7009884fdce6b8f683d24fcfa96 Mon Sep 17 00:00:00 2001
From: Sergey Yakubov <sergey.yakubov@desy.de>
Date: Sat, 2 Dec 2017 11:11:48 +0100
Subject: [PATCH] adjust for macos

---
 CMakeModules/astyle.cmake      | 2 --
 CMakeModules/testing_cpp.cmake | 3 ++-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/CMakeModules/astyle.cmake b/CMakeModules/astyle.cmake
index c0d960921..811506bf6 100644
--- a/CMakeModules/astyle.cmake
+++ b/CMakeModules/astyle.cmake
@@ -1,7 +1,5 @@
 find_program(ASTYLE_EXECUTABLE astyle)
 
-add_custom_target(ASTYLE)
-
 if(ASTYLE_EXECUTABLE)
 	message(STATUS "Found astyle, using astyle to format code of target ${target}.")
 	add_custom_target(astyle ALL
diff --git a/CMakeModules/testing_cpp.cmake b/CMakeModules/testing_cpp.cmake
index 01179b9c1..73acb03da 100644
--- a/CMakeModules/testing_cpp.cmake
+++ b/CMakeModules/testing_cpp.cmake
@@ -16,9 +16,10 @@ function(gtest target test_source_files test_libraries)
 
         message(STATUS "Added test 'test-${target}'")
 
-        if (CMAKE_COMPILER_IS_GNUCXX)
+        if ((CMAKE_COMPILER_IS_GNUCXX) OR ("${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang"))
             include(CodeCoverage)
             APPEND_COVERAGE_COMPILER_FLAGS()
+            set (COVERAGE_EXCLUDES '*/unittests/*')
             SETUP_TARGET_FOR_COVERAGE(NAME coverage-${target} EXECUTABLE test-${target} ${target})
             add_test(NAME coveragetest-${target}
                     COMMAND ${CMAKE_MODULE_PATH}/check_test.sh
-- 
GitLab