LayerManagement: enabled "coverage" build setting for GCC
authorTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Thu, 10 May 2012 12:36:44 +0000 (14:36 +0200)
committerTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Thu, 10 May 2012 12:36:44 +0000 (14:36 +0200)
If LayerManagement is build on a GCC-based platform, an additional
build setting named 'coverage' is available.
Building with this setting results in intrumented versions.
The result can be used with gcov-based tools.

CMakeLists.txt
cmake/optionalFeatures/CMakeLists.txt [new file with mode: 0644]
cmake/optionalFeatures/codeCoverage/CMakeLists.txt [new file with mode: 0644]

index ac87d33..572052d 100644 (file)
@@ -54,6 +54,8 @@ option (WITH_WAYLAND_X11    "Build Wayland with X11 backend"
 
 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
 
+add_subdirectory(cmake/optionalFeatures)
+
 add_subdirectory(config)
 
 if (WITH_DESKTOP)
diff --git a/cmake/optionalFeatures/CMakeLists.txt b/cmake/optionalFeatures/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9863c5e
--- /dev/null
@@ -0,0 +1,23 @@
+############################################################################
+# 
+# Copyright 2010, 2011 BMW Car IT GmbH  
+# Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
+# 
+# 
+# Licensed under the Apache License, Version 2.0 (the "License"); 
+# you may not use this file except in compliance with the License. 
+# You may obtain a copy of the License at 
+#
+#       http://www.apache.org/licenses/LICENSE-2.0 
+#
+# Unless required by applicable law or agreed to in writing, software 
+# distributed under the License is distributed on an "AS IS" BASIS, 
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+# See the License for the specific language governing permissions and 
+# limitations under the License.
+#
+############################################################################
+
+cmake_minimum_required (VERSION 2.6)
+
+add_subdirectory(codeCoverage)
diff --git a/cmake/optionalFeatures/codeCoverage/CMakeLists.txt b/cmake/optionalFeatures/codeCoverage/CMakeLists.txt
new file mode 100644 (file)
index 0000000..912ab0b
--- /dev/null
@@ -0,0 +1,41 @@
+############################################################################
+# 
+# Copyright 2010, 2011 BMW Car IT GmbH
+# 
+# 
+# Licensed under the Apache License, Version 2.0 (the "License"); 
+# you may not use this file except in compliance with the License. 
+# You may obtain a copy of the License at 
+#
+#       http://www.apache.org/licenses/LICENSE-2.0 
+#
+# Unless required by applicable law or agreed to in writing, software 
+# distributed under the License is distributed on an "AS IS" BASIS, 
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+# See the License for the specific language governing permissions and 
+# limitations under the License.
+#
+############################################################################
+
+cmake_minimum_required (VERSION 2.6)
+
+# this file adds a new build-setting 'coverage',
+# if all required tools are found
+
+if(CMAKE_COMPILER_IS_GNUCC)
+    message(STATUS "GCC detected, enabled 'coverage' build configuration")
+
+    SET(GCC_COVERAGE_FLAGS "-fprofile-arcs -ftest-coverage")
+
+    # compiler
+    
+    SET(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_DEBUG} ${GCC_COVERAGE_FLAGS}" CACHE STRING "" FORCE)
+    SET(CMAKE_C_FLAGS_COVERAGE   "${CMAKE_C_FLAGS_DEBUG} ${GCC_COVERAGE_FLAGS}" CACHE STRING "" FORCE)
+
+    # linker
+    
+    SET(CMAKE_EXE_LINKER_FLAGS_COVERAGE      "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${GCC_COVERAGE_FLAGS}" CACHE STRING "" FORCE)
+    SET(CMAKE_MODULE_LINKER_FLAGS_COVERAGE   "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} ${GCC_COVERAGE_FLAGS}" CACHE STRING "" FORCE)
+    SET(CMAKE_SHARED_LINKER_FLAGS_COVERAGE   "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} ${GCC_COVERAGE_FLAGS}" CACHE STRING "" FORCE)
+
+endif(CMAKE_COMPILER_IS_GNUCC)