Mercurial > hg > orthanc
diff Resources/CMake/Compiler.cmake @ 2175:bed8e7ad8bab
ENABLE_PROFILING cmake option
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 24 Nov 2016 12:58:43 +0100 |
parents | e18023c2fdfb |
children | f47fd47b3c91 |
line wrap: on
line diff
--- a/Resources/CMake/Compiler.cmake Wed Nov 23 16:12:04 2016 +0100 +++ b/Resources/CMake/Compiler.cmake Thu Nov 24 12:58:43 2016 +0100 @@ -164,6 +164,23 @@ endif() +if (DEFINED ENABLE_PROFILING AND ENABLE_PROFILING) + if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + message(WARNING "Enabling profiling on a non-debug build will not produce full information") + endif() + + if (CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -pg") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg") + else() + message(FATAL_ERROR "Don't know how to enable profiling on your configuration") + endif() +endif() + + if (STATIC_BUILD) add_definitions(-DORTHANC_STATIC=1) else()