From 285f5661ea1c54ae4238a92f1684fd9daffcab2a Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 23 Sep 2019 14:49:25 -0700 Subject: 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 --- CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'CMakeLists.txt') 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") -- cgit v1.2.3-70-g09d2