diff --git a/grid_map_core/CMakeLists.txt b/grid_map_core/CMakeLists.txt
index 86c11e63c..0a9962d82 100644
--- a/grid_map_core/CMakeLists.txt
+++ b/grid_map_core/CMakeLists.txt
@@ -128,3 +128,15 @@ endif()
if(TARGET ${PROJECT_NAME}-test)
target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
endif()
+
+##################
+# Code_coverage ##
+##################
+
+find_package(cmake_code_coverage QUIET)
+if(cmake_code_coverage_FOUND)
+ add_gtest_coverage(
+ TEST_BUILD_TARGETS
+ ${PROJECT_NAME}-test
+ )
+endif(cmake_code_coverage_FOUND)
\ No newline at end of file
diff --git a/grid_map_core/package.xml b/grid_map_core/package.xml
index 58dc495f6..2e20b55ac 100644
--- a/grid_map_core/package.xml
+++ b/grid_map_core/package.xml
@@ -11,4 +11,5 @@
Péter Fankhauser
catkin
eigen
+ cmake_code_coverage
diff --git a/grid_map_costmap_2d/CMakeLists.txt b/grid_map_costmap_2d/CMakeLists.txt
index d792af52f..3998a22cf 100644
--- a/grid_map_costmap_2d/CMakeLists.txt
+++ b/grid_map_costmap_2d/CMakeLists.txt
@@ -73,3 +73,15 @@ endif()
if(TARGET ${PROJECT_NAME}-test)
target_link_libraries(${PROJECT_NAME}-test ${catkin_LIBRARIES})
endif()
+
+##################
+# Code_coverage ##
+##################
+
+find_package(cmake_code_coverage QUIET)
+if(cmake_code_coverage_FOUND)
+ add_gtest_coverage(
+ TEST_BUILD_TARGETS
+ ${PROJECT_NAME}-test
+ )
+endif(cmake_code_coverage_FOUND)
\ No newline at end of file
diff --git a/grid_map_costmap_2d/package.xml b/grid_map_costmap_2d/package.xml
index 1cd177e3c..d569011de 100644
--- a/grid_map_costmap_2d/package.xml
+++ b/grid_map_costmap_2d/package.xml
@@ -13,4 +13,5 @@
grid_map_core
costmap_2d
tf
+ cmake_code_coverage
diff --git a/grid_map_cv/CMakeLists.txt b/grid_map_cv/CMakeLists.txt
index f528f5522..8734ab7d7 100644
--- a/grid_map_cv/CMakeLists.txt
+++ b/grid_map_cv/CMakeLists.txt
@@ -105,3 +105,14 @@ if(TARGET ${PROJECT_NAME}-test)
target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
endif()
+##################
+# Code_coverage ##
+##################
+
+find_package(cmake_code_coverage QUIET)
+if(cmake_code_coverage_FOUND)
+ add_gtest_coverage(
+ TEST_BUILD_TARGETS
+ ${PROJECT_NAME}-test
+ )
+endif(cmake_code_coverage_FOUND)
\ No newline at end of file
diff --git a/grid_map_cv/package.xml b/grid_map_cv/package.xml
index 13209229b..8ed0c7d72 100644
--- a/grid_map_cv/package.xml
+++ b/grid_map_cv/package.xml
@@ -13,6 +13,7 @@
grid_map_core
cv_bridge
filters
+ cmake_code_coverage
diff --git a/grid_map_octomap/CMakeLists.txt b/grid_map_octomap/CMakeLists.txt
index cdcc03ac1..e9329c362 100644
--- a/grid_map_octomap/CMakeLists.txt
+++ b/grid_map_octomap/CMakeLists.txt
@@ -103,3 +103,15 @@ if(TARGET ${PROJECT_NAME}-test)
${OCTOMAP_LIBRARIES}
)
endif()
+
+##################
+# Code_coverage ##
+##################
+
+find_package(cmake_code_coverage QUIET)
+if(cmake_code_coverage_FOUND)
+ add_gtest_coverage(
+ TEST_BUILD_TARGETS
+ ${PROJECT_NAME}-test
+ )
+endif(cmake_code_coverage_FOUND)
\ No newline at end of file
diff --git a/grid_map_octomap/package.xml b/grid_map_octomap/package.xml
index c580958d7..d3676392f 100644
--- a/grid_map_octomap/package.xml
+++ b/grid_map_octomap/package.xml
@@ -13,4 +13,5 @@
catkin
grid_map_core
octomap
+ cmake_code_coverage
diff --git a/grid_map_pcl/CMakeLists.txt b/grid_map_pcl/CMakeLists.txt
index b421858b0..a4d6b467f 100644
--- a/grid_map_pcl/CMakeLists.txt
+++ b/grid_map_pcl/CMakeLists.txt
@@ -135,3 +135,14 @@ if(TARGET ${PROJECT_NAME}-test)
${catkin_LIBRARIES})
endif()
+##################
+# Code_coverage ##
+##################
+
+find_package(cmake_code_coverage QUIET)
+if(cmake_code_coverage_FOUND)
+ add_gtest_coverage(
+ TEST_BUILD_TARGETS
+ ${PROJECT_NAME}-test
+ )
+endif(cmake_code_coverage_FOUND)
\ No newline at end of file
diff --git a/grid_map_pcl/package.xml b/grid_map_pcl/package.xml
index b10773be3..c27f3e7f8 100644
--- a/grid_map_pcl/package.xml
+++ b/grid_map_pcl/package.xml
@@ -18,4 +18,5 @@
pcl_ros
roscpp
yaml-cpp
+ cmake_code_coverage
diff --git a/grid_map_ros/CMakeLists.txt b/grid_map_ros/CMakeLists.txt
index b3112147b..10313702d 100644
--- a/grid_map_ros/CMakeLists.txt
+++ b/grid_map_ros/CMakeLists.txt
@@ -113,3 +113,15 @@ endif()
if(TARGET ${PROJECT_NAME}-test)
target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
endif()
+
+##################
+# Code_coverage ##
+##################
+
+find_package(cmake_code_coverage QUIET)
+if(cmake_code_coverage_FOUND)
+ add_gtest_coverage(
+ TEST_BUILD_TARGETS
+ ${PROJECT_NAME}-test
+ )
+endif(cmake_code_coverage_FOUND)
\ No newline at end of file
diff --git a/grid_map_ros/package.xml b/grid_map_ros/package.xml
index 0d747c168..8af65d26a 100644
--- a/grid_map_ros/package.xml
+++ b/grid_map_ros/package.xml
@@ -22,4 +22,5 @@
rosbag
tf
visualization_msgs
+ cmake_code_coverage
diff --git a/grid_map_sdf/CMakeLists.txt b/grid_map_sdf/CMakeLists.txt
index a801529d4..c70f247af 100644
--- a/grid_map_sdf/CMakeLists.txt
+++ b/grid_map_sdf/CMakeLists.txt
@@ -84,3 +84,15 @@ if(TARGET ${PROJECT_NAME}-test)
target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
endif()
+
+##################
+# Code_coverage ##
+##################
+
+find_package(cmake_code_coverage QUIET)
+if(cmake_code_coverage_FOUND)
+ add_gtest_coverage(
+ TEST_BUILD_TARGETS
+ ${PROJECT_NAME}-test
+ )
+endif(cmake_code_coverage_FOUND)
\ No newline at end of file
diff --git a/grid_map_sdf/package.xml b/grid_map_sdf/package.xml
index 011eed6b3..715003a8b 100644
--- a/grid_map_sdf/package.xml
+++ b/grid_map_sdf/package.xml
@@ -13,4 +13,5 @@
catkin
grid_map_core
pcl_ros
+ cmake_code_coverage