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

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

index 9863c5e..ab4a012 100644 (file)
@@ -21,3 +21,4 @@
 cmake_minimum_required (VERSION 2.6)
 
 add_subdirectory(codeCoverage)
+add_subdirectory(profiling)
diff --git a/cmake/optionalFeatures/profiling/CMakeLists.txt b/cmake/optionalFeatures/profiling/CMakeLists.txt
new file mode 100644 (file)
index 0000000..a80de89
--- /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 'profiling',
+# if all required tools are found
+
+if(CMAKE_COMPILER_IS_GNUCC)
+    message(STATUS "GCC detected, enabled 'profiling' build configuration")
+
+    SET(GCC_PROFILING_FLAGS "-g -pg")
+
+    # compiler
+    
+    SET(CMAKE_CXX_FLAGS_PROFILING "${GCC_PROFILING_FLAGS}" CACHE STRING "" FORCE)
+    SET(CMAKE_C_FLAGS_PROFILING   "${GCC_PROFILING_FLAGS}" CACHE STRING "" FORCE)
+
+    # linker
+    
+    SET(CMAKE_EXE_LINKER_FLAGS_PROFILING      "${GCC_PROFILING_FLAGS}" CACHE STRING "" FORCE)
+    SET(CMAKE_MODULE_LINKER_FLAGS_PROFILING   "${GCC_PROFILING_FLAGS}" CACHE STRING "" FORCE)
+    SET(CMAKE_SHARED_LINKER_FLAGS_PROFILING   "${GCC_PROFILING_FLAGS}" CACHE STRING "" FORCE)
+
+endif(CMAKE_COMPILER_IS_GNUCC)