Fixed build when tcmalloc is not found
This commit is contained in:
parent
98e605e3d1
commit
9943c28b88
@ -23,6 +23,13 @@ ENDIF(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
|
||||
INCLUDE(GNUInstallDirs)
|
||||
|
||||
####### local cmake modules #######
|
||||
SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake_modules")
|
||||
|
||||
if(POLICY CMP0043)
|
||||
cmake_policy(SET CMP0043 OLD)
|
||||
endif()
|
||||
|
||||
#######################
|
||||
# VERSION
|
||||
#######################
|
||||
@ -48,6 +55,8 @@ IF(NOT Qt5_FOUND)
|
||||
ENDIF(NOT Qt5_FOUND)
|
||||
ADD_DEFINITIONS(-DQT_NO_KEYWORDS) # To avoid conflicts with boost signals used in ROS
|
||||
|
||||
FIND_PACKAGE(Tcmalloc QUIET)
|
||||
|
||||
SET(NONFREE 0)
|
||||
IF(OPENCV_NONFREE_FOUND OR OPENCV_XFEATURES2D_FOUND)
|
||||
SET(NONFREE 1)
|
||||
@ -253,6 +262,12 @@ IF(NOT CATKIN_BUILD)
|
||||
MESSAGE(STATUS " With Qt = NO (Qt not found)")
|
||||
ENDIF()
|
||||
|
||||
IF(Tcmalloc_FOUND)
|
||||
MESSAGE(STATUS " With tcmalloc = YES")
|
||||
ELSE()
|
||||
MESSAGE(STATUS " With tcmalloc = NO (tcmalloc not found)")
|
||||
ENDIF(Tcmalloc_FOUND)
|
||||
|
||||
IF(APPLE)
|
||||
MESSAGE(STATUS " BUILD_AS_BUNDLE = ${BUILD_AS_BUNDLE}")
|
||||
ENDIF(APPLE)
|
||||
|
||||
@ -24,6 +24,14 @@ SET(LIBRARIES
|
||||
${OpenCV_LIBS}
|
||||
)
|
||||
|
||||
if(Tcmalloc_FOUND)
|
||||
SET(LIBRARIES
|
||||
${LIBARIES}
|
||||
${Tcmalloc_LIBRARIES}
|
||||
)
|
||||
endif(Tcmalloc_FOUND)
|
||||
|
||||
|
||||
#include files
|
||||
INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
|
||||
|
||||
|
||||
34
cmake_modules/FindTcmalloc.cmake
Normal file
34
cmake_modules/FindTcmalloc.cmake
Normal file
@ -0,0 +1,34 @@
|
||||
# - Find Tcmalloc
|
||||
# Find the native Tcmalloc library
|
||||
#
|
||||
# Tcmalloc_LIBRARIES - List of libraries when using Tcmalloc.
|
||||
# Tcmalloc_FOUND - True if Tcmalloc found.
|
||||
|
||||
if (USE_TCMALLOC)
|
||||
set(Tcmalloc_NAMES tcmalloc)
|
||||
else ()
|
||||
set(Tcmalloc_NAMES tcmalloc_minimal tcmalloc)
|
||||
endif ()
|
||||
|
||||
find_library(Tcmalloc_LIBRARY NAMES ${Tcmalloc_NAMES})
|
||||
|
||||
if (Tcmalloc_LIBRARY)
|
||||
set(Tcmalloc_FOUND TRUE)
|
||||
set( Tcmalloc_LIBRARIES ${Tcmalloc_LIBRARY} )
|
||||
else ()
|
||||
set(Tcmalloc_FOUND FALSE)
|
||||
set( Tcmalloc_LIBRARIES )
|
||||
endif ()
|
||||
|
||||
if (Tcmalloc_FOUND)
|
||||
message(STATUS "Found Tcmalloc: ${Tcmalloc_LIBRARY}")
|
||||
else ()
|
||||
message(STATUS "Not Found Tcmalloc: ${Tcmalloc_LIBRARY}")
|
||||
if (Tcmalloc_FIND_REQUIRED)
|
||||
message(STATUS "Looked for Tcmalloc libraries named ${Tcmalloc_NAMES}.")
|
||||
message(FATAL_ERROR "Could NOT find Tcmalloc library")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(Tcmalloc_LIBRARY)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user