File: FindGtest.cmake

package info (click to toggle)
gazebo 11.1.0%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 117,564 kB
  • sloc: cpp: 355,280; xml: 20,974; ansic: 9,598; python: 2,409; javascript: 785; sh: 391; ruby: 375; makefile: 56
file content (40 lines) | stat: -rw-r--r-- 1,479 bytes parent folder | download | duplicates (3)
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
###############################################################################
# Find GTest
#
# This sets the following variables:
# GTEST_FOUND - True if GTest was found.
# GTEST_INCLUDE_DIRS - Directories containing the GTest include files.
# GTEST_SRC - Directories containing the GTest source files.

if(CMAKE_SYSTEM_NAME STREQUAL Linux)
    set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} /usr /usr/local)
endif(CMAKE_SYSTEM_NAME STREQUAL Linux)
if(APPLE)
  list(APPEND CMAKE_INCLUDE_PATH /opt/local)
  set(CMAKE_FIND_FRAMEWORK NEVER)
endif()

find_path(GTEST_INCLUDE_DIR gtest/gtest.h
    HINTS "${GTEST_ROOT}" "$ENV{GTEST_ROOT}"
    PATHS "$ENV{PROGRAMFILES}/gtest" "$ENV{PROGRAMW6432}/gtest"
    PATHS "$ENV{PROGRAMFILES}/gtest-1.7.0" "$ENV{PROGRAMW6432}/gtest-1.7.0"
    PATH_SUFFIXES gtest include/gtest include)

find_path(GTEST_SRC_DIR src/gtest-all.cc
    HINTS "${GTEST_ROOT}" "$ENV{GTEST_ROOT}"
    PATHS "$ENV{PROGRAMFILES}/gtest" "$ENV{PROGRAMW6432}/gtest"
    PATHS "$ENV{PROGRAMFILES}/gtest-1.7.0" "$ENV{PROGRAMW6432}/gtest-1.7.0"
    PATH /usr/src/gtest
    PATH_SUFFIXES gtest src/gtest)

set(GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIR})
set(CMAKE_FIND_FRAMEWORK)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Gtest DEFAULT_MSG GTEST_INCLUDE_DIR GTEST_SRC_DIR)

mark_as_advanced(GTEST_INCLUDE_DIR GTEST_SRC_DIR)

if(GTEST_FOUND)
  message(STATUS "GTest found (include: ${GTEST_INCLUDE_DIRS}, src: ${GTEST_SRC_DIR})")
endif(GTEST_FOUND)