mirror of
https://github.com/ceph/ceph
synced 2025-03-22 10:17:23 +00:00
cmake: fix gperftools version detection
there is chance that its "patch" version is empty. in that case, do not include it in its version string. otherwise, we will have something like: Found gperftools: GPERFTOOLS_TCMALLOC_LIBRARY;GPERFTOOLS_TCMALLOC_MINIMAL_LIBRARY;GPERFTOOLS_PROFILER_LIBRARY (found version "2.4.#define TC_VERSION_PATCH """) when running cmake Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
parent
8717eac498
commit
caae3c4757
@ -21,12 +21,14 @@ if(Tcmalloc_INCLUDE_DIR AND EXISTS "${Tcmalloc_INCLUDE_DIR}/gperftools/tcmalloc.
|
||||
foreach(ver "MAJOR" "MINOR" "PATCH")
|
||||
file(STRINGS "${Tcmalloc_INCLUDE_DIR}/gperftools/tcmalloc.h" TC_VER_${ver}_LINE
|
||||
REGEX "^#define[ \t]+TC_VERSION_${ver}[ \t]+[^ \t]+$")
|
||||
string(REGEX REPLACE "^#define[ \t]+TC_VERSION_${ver}[ \t]+(\".)?([0-9]+)\"?$"
|
||||
string(REGEX REPLACE "^#define[ \t]+TC_VERSION_${ver}[ \t]+(\".)?([0-9]*)\"?$"
|
||||
"\\2" TCMALLOC_VERSION_${ver} "${TC_VER_${ver}_LINE}")
|
||||
unset(TC_VER_${ver}_LINE)
|
||||
endforeach()
|
||||
set(TCMALLOC_VERSION_STRING
|
||||
"${TCMALLOC_VERSION_MAJOR}.${TCMALLOC_VERSION_MINOR}.${TCMALLOC_VERSION_PATCH}")
|
||||
set(TCMALLOC_VERSION_STRING "${TCMALLOC_VERSION_MAJOR}.${TCMALLOC_VERSION_MINOR}")
|
||||
if(NOT TCMALLOC_VERSION_PATCH STREQUAL "")
|
||||
set(TCMALLOC_VERSION_STRING "${TCMALLOC_VERSION_STRING}.${TCMALLOC_VERSION_PATCH}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
foreach(component tcmalloc tcmalloc_minimal profiler)
|
||||
|
Loading…
Reference in New Issue
Block a user