summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorchuck.bell@oracle.com <>2011-05-12 18:22:14 -0400
committerchuck.bell@oracle.com <>2011-05-12 18:22:14 -0400
commit44b2df4abaf82055855892e3bdf29f43d1f8cd05 (patch)
tree1b4de4a2864b3bd09694ed6b09646bd5985fc388 /CMakeLists.txt
parent7577c115a028eb0b713878fdd3be95a018bd9cdb (diff)
downloadmariadb-git-44b2df4abaf82055855892e3bdf29f43d1f8cd05.tar.gz
BUG#12549572 : CMake file does not include gcov option
This patch inserts an 'ENABLE_GCOV' option for enabling gcov compilation on Linux machines. It modifies the CMakeLists.txt setting this option to 'OFF' by default. Note: The option requires a debug build. For example, -DCMAKE_BUILD_TYPE:string="Debug"
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt7
1 files changed, 7 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 235a65a6437..6766f76c665 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -172,6 +172,13 @@ IF(ENABLE_DEBUG_SYNC)
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
ENDIF()
+OPTION(ENABLE_GCOV "Enable gcov (debug, Linux builds only)" OFF)
+IF (ENABLE_GCOV AND NOT WIN32 AND NOT APPLE)
+ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage")
+ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage")
+ SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage -lgcov")
+ENDIF()
+
OPTION(ENABLED_LOCAL_INFILE
"If we should should enable LOAD DATA LOCAL by default" ${IF_WIN})
MARK_AS_ADVANCED(ENABLED_LOCAL_INFILE)