1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-12-07 09:08:05 +00:00

Imported target for GPerftools

This commit is contained in:
Carles Fernandez
2019-02-07 20:31:40 +01:00
parent 627ab01707
commit 54473809f7
3 changed files with 70 additions and 28 deletions

View File

@@ -1,4 +1,4 @@
# Copyright (C) 2011-2018 (see AUTHORS file for a list of contributors)
# Copyright (C) 2011-2019 (see AUTHORS file for a list of contributors)
#
# This file is part of GNSS-SDR.
#
@@ -33,6 +33,12 @@
# GPERFTOOLS_FOUND System has Gperftools libs/headers
# GPERFTOOLS_LIBRARIES The Gperftools libraries (tcmalloc & profiler)
# GPERFTOOLS_INCLUDE_DIR The location of Gperftools headers
#
# Provides the following imported targets:
# Gperftools::tcmalloc
# Gperftools::profiler
# Gperftools::gperftools
#
find_library(GPERFTOOLS_TCMALLOC
NAMES tcmalloc
@@ -41,6 +47,8 @@ find_library(GPERFTOOLS_TCMALLOC
$ENV{GPERFTOOLS_ROOT}/lib
${GPERFTOOLS_ROOT}/lib64
$ENV{GPERFTOOLS_ROOT}/lib64
/usr/lib
/usr/lib64
)
find_library(GPERFTOOLS_PROFILER
@@ -50,6 +58,8 @@ find_library(GPERFTOOLS_PROFILER
$ENV{GPERFTOOLS_ROOT}/lib
${GPERFTOOLS_ROOT}/lib64
$ENV{GPERFTOOLS_ROOT}/lib64
/usr/lib
/usr/lib64
)
find_library(GPERFTOOLS_TCMALLOC_AND_PROFILER
@@ -59,6 +69,8 @@ find_library(GPERFTOOLS_TCMALLOC_AND_PROFILER
$ENV{GPERFTOOLS_ROOT}/lib
${GPERFTOOLS_ROOT}/lib64
$ENV{GPERFTOOLS_ROOT}/lib64
/usr/lib
/usr/lib64
)
find_path(GPERFTOOLS_INCLUDE_DIR
@@ -66,6 +78,7 @@ find_path(GPERFTOOLS_INCLUDE_DIR
HINTS ${Gperftools_ROOT_DIR}/include
${GPERFTOOLS_ROOT}/include
$ENV{GPERFTOOLS_ROOT}/include
/usr/include
)
set(GPERFTOOLS_LIBRARIES ${GPERFTOOLS_TCMALLOC_AND_PROFILER})
@@ -76,10 +89,42 @@ find_package_handle_standard_args(
DEFAULT_MSG
GPERFTOOLS_LIBRARIES
GPERFTOOLS_INCLUDE_DIR
GPERFTOOLS_TCMALLOC
GPERFTOOLS_PROFILER
)
if(GPERFTOOLS_FOUND AND NOT TARGET Gperftools::tcmalloc)
add_library(Gperftools::tcmalloc SHARED IMPORTED)
set_target_properties(Gperftools::tcmalloc PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${GPERFTOOLS_TCMALLOC}"
INTERFACE_INCLUDE_DIRECTORIES "${GPERFTOOLS_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${GPERFTOOLS_TCMALLOC}"
)
endif()
if(GPERFTOOLS_FOUND AND NOT TARGET Gperftools::profiler)
add_library(Gperftools::profiler SHARED IMPORTED)
set_target_properties(Gperftools::profiler PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${GPERFTOOLS_PROFILER}"
INTERFACE_INCLUDE_DIRECTORIES "${GPERFTOOLS_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${GPERFTOOLS_PROFILER}"
)
endif()
if(GPERFTOOLS_FOUND AND NOT TARGET Gperftools::gperftools)
add_library(Gperftools::gperftools SHARED IMPORTED)
set_target_properties(Gperftools::gperftools PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${GPERFTOOLS_TCMALLOC_AND_PROFILER}"
INTERFACE_INCLUDE_DIRECTORIES "${GPERFTOOLS_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${GPERFTOOLS_TCMALLOC_AND_PROFILER}"
)
endif()
mark_as_advanced(
Gperftools_ROOT_DIR
GPERFTOOLS_TCMALLOC
GPERFTOOLS_PROFILER
GPERFTOOLS_TCMALLOC_AND_PROFILER