File: FindJemalloc.cmake

package info (click to toggle)
satdump 1.2.2%2Bgb79af48-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 81,648 kB
  • sloc: cpp: 276,768; ansic: 164,598; lisp: 1,219; sh: 283; xml: 106; makefile: 7
file content (56 lines) | stat: -rw-r--r-- 1,750 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#
# Find the JEMALLOC client includes and library
# Source: https://gist.github.com/Lewiscowles1986/225a10154637d18d6187147015c8d0f7
# 

# This module defines
# JEMALLOC_INCLUDE_DIR, where to find jemalloc.h
# JEMALLOC_LIBRARIES, the libraries to link against
# JEMALLOC_FOUND, if false, you cannot build anything that requires JEMALLOC

# also defined, but not for general use are
# JEMALLOC_LIBRARY, where to find the JEMALLOC library.

set( JEMALLOC_FOUND 0 )

if ( UNIX )
  FIND_PATH( JEMALLOC_INCLUDE_DIR
    NAMES
      jemalloc/jemalloc.h
    PATHS
      /usr/include
      /usr/include/jemalloc
      /usr/local/include
      /usr/local/include/jemalloc
      $ENV{JEMALLOC_ROOT}
      $ENV{JEMALLOC_ROOT}/include
      ${CMAKE_SOURCE_DIR}/externals/jemalloc
  DOC
    "Specify include-directories that might contain jemalloc.h here."
  )
  FIND_LIBRARY( JEMALLOC_LIBRARY 
    NAMES
      jemalloc libjemalloc JEMALLOC
    PATHS
      /usr/lib
      /usr/lib/jemalloc
      /usr/local/lib
      /usr/local/lib/jemalloc
      /usr/local/jemalloc/lib
      $ENV{JEMALLOC_ROOT}/lib
      $ENV{JEMALLOC_ROOT}
    DOC "Specify library-locations that might contain the jemalloc library here."
  )

  if ( JEMALLOC_LIBRARY )
    if ( JEMALLOC_INCLUDE_DIR )
      set( JEMALLOC_FOUND 1 )
      message( STATUS "Found JEMALLOC library: ${JEMALLOC_LIBRARY}")
      message( STATUS "Found JEMALLOC headers: ${JEMALLOC_INCLUDE_DIR}")
    else ( JEMALLOC_INCLUDE_DIR )
      message(FATAL_ERROR "Could not find jemalloc headers! Please install jemalloc libraries and headers")
    endif ( JEMALLOC_INCLUDE_DIR )
  endif ( JEMALLOC_LIBRARY )

  mark_as_advanced( JEMALLOC_FOUND JEMALLOC_LIBRARY JEMALLOC_EXTRA_LIBRARIES JEMALLOC_INCLUDE_DIR )
endif (UNIX)