From cc4d491d6c65d244bd41f707cf45057f7b23d634 Mon Sep 17 00:00:00 2001 From: Matthew Parlane Date: Sun, 30 Dec 2012 17:48:22 +1300 Subject: [PATCH] Add ability to enable GPROF in cmake. --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a2908d27b6..bb0989cf89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -208,9 +208,16 @@ if(NOT CMAKE_BUILD_TYPE) "Build type (Release/Debug/RelWithDebInfo/MinSizeRe)" FORCE) endif(NOT CMAKE_BUILD_TYPE) + if(CMAKE_BUILD_TYPE STREQUAL Debug) add_definitions(-D_DEBUG -ggdb) set(wxWidgets_USE_DEBUG ON CACHE BOOL "Use wxWidgets Debugging") + + option(ENABLE_GPROF "Enable gprof profiling (must be using Debug build)" OFF) + if(ENABLE_GPROF) + add_definitions(-pg) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg") + endif() endif(CMAKE_BUILD_TYPE STREQUAL Debug) if(CMAKE_BUILD_TYPE STREQUAL Release)