FindGBenchmark.cmake 998 Bytes
Newer Older
1 2 3 4 5 6
# Find the Google Benchmark library
# Defines:
#  GBENCHMARK_INCLUDE_DIR  - gbenchmark include directory
#  GBENCHMARK_LIBRARY      - gbenchmark library file
#  GBENCHMARK_FOUND        - TRUE if gbenchmark is found

7 8 9 10 11
set(GBENCHMARK_FIND_QUIETLY TRUE)
# if (GBENCHMARK_INCLUDE_DIR)
#  #check cache
#   set(GBENCHMARK_FIND_QUIETLY TRUE)
# endif ()
12 13 14

if (NOT GBENCHMARK_INCLUDE_DIR)
  find_path(GBENCHMARK_INCLUDE_DIR NAMES benchmark.h PATH_SUFFIXES benchmark)
15
  set(GBENCHMARK_INCLUDE_DIR ${GBENCHMARK_INCLUDE_DIR}/benchmark CACHE PATH "Google.benchmark include directory")
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
endif ()

mark_as_advanced(GBENCHMARK_INCLUDE_DIR)

find_library(GBENCHMARK_LIBRARY NAMES benchmark)
mark_as_advanced(GBENCHMARK_LIBRARY)

include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GBENCHMARK
  REQUIRED_VARS GBENCHMARK_LIBRARY GBENCHMARK_INCLUDE_DIR
  )
#VERSION_VAR GBENCHMARK_VERSION_STRING

set(GBENCHMARK_LIBRARIES ${GBENCHMARK_LIBRARY})
set(GBENCHMARK_INCLUDE_DIRS ${GBENCHMARK_INCLUDE_DIR})