From cf6dcf0ae7a21c88de8589dce83abb36baf8d716 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 20 Jul 2016 13:48:54 +0800 Subject: [PATCH] cmake: add "WITH_PROFILER" option this option matches '--with-profiler' option in autoconf. and it is off by default. we should not link against libprofiler unless asked to do so. this change fixes this problem. Signed-off-by: Kefu Chai --- src/CMakeLists.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3262674165db5..b08b3b2f87ee1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -199,9 +199,10 @@ endif(INTEL_SSE4_1) set(EXTRALIBS uuid rt ${CMAKE_DL_LIBS} ${ATOMIC_OPS_LIBRARIES}) -if(${WITH_PROFILER}) +option(WITH_PROFILER "build extra profiler binaries" OFF) +if(WITH_PROFILER) list(APPEND EXTRALIBS profiler) -endif(${WITH_PROFILER}) +endif(WITH_PROFILER) if(${ENABLE_COVERAGE}) find_program(HAVE_GCOV gcov) @@ -475,13 +476,13 @@ set(common_mountcephfs_files add_library(common_mountcephfs_objs OBJECT ${common_mountcephfs_files}) -if(${HAVE_GPERFTOOLS}) +if(WITH_PROFILER AND HAVE_GPERFTOOLS) list(APPEND libcommon_files perfglue/cpu_profiler.cc) else() list(APPEND libcommon_files perfglue/disabled_stubs.cc) -endif(${HAVE_GPERFTOOLS}) +endif(WITH_PROFILER AND HAVE_GPERFTOOLS) if(ENABLE_SHARED) list(APPEND libcommon_files -- 2.39.5