aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2019-09-23 14:49:25 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-10-02 08:04:49 -0700
commit285f5661ea1c54ae4238a92f1684fd9daffcab2a (patch)
tree9b9e2a8e7c8cc90f14bd0badde61e7efd9647d5b /CMakeLists.txt
parent94b8d4070f3df36df1cd665dfe129c5eda425532 (diff)
downloadsubsurface-285f5661ea1c54ae4238a92f1684fd9daffcab2a.tar.gz
build-system: add option to enable profiling
Simply nice to have - even though it didn't help me track down the issue this time around. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt10
1 files changed, 10 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 074155b1d..7a5291a69 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,6 +24,9 @@ MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
"We don't support building in source, please create a build folder elsewhere and remember to run git clean -xdf to remove temporary files created by CMake."
)
+#Option for profiling
+option(SUBSURFACE_PROFILING_BUILD "enable profiling of Subsurface binary" OFF)
+
#Options regarding usage of pkgconfig
option(LIBGIT2_FROM_PKGCONFIG "use pkg-config to retrieve libgit2" OFF)
option(LIBDC_FROM_PKGCONFIG "use pkg-config to retrieve libdivecomputer" OFF)
@@ -97,6 +100,13 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# using Visual Studio C++
endif()
+# set up profiling
+if (SUBSURFACE_PROFILING_BUILD)
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
+ SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
+ SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg")
+endif()
+
# every compiler understands -Wall
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")