diff --git a/CMakeModules/astyle.cmake b/CMakeModules/astyle.cmake
index c0d960921d5881a1f8565dcf0e913b123a3f89e0..811506bf65aa79e45b40e134720e42ac39e5262d 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 01179b9c1dfdd7ce0738c1f0d0fe65116b8c774c..73acb03da43cf2a883f35d4e4f1ad9abe25c0946 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