2020-12-30 12:35:06 +00:00
|
|
|
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
2019-03-09 00:39:32 +00:00
|
|
|
# This file is part of GNSS-SDR.
|
|
|
|
#
|
2020-12-30 12:35:06 +00:00
|
|
|
# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es
|
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
2019-03-09 00:39:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
# - Try to find Googletest source code
|
|
|
|
#
|
|
|
|
# The following environment variable is optionally searched for:
|
|
|
|
# GTEST_DIR: Base directory where Googletest source code is found.
|
|
|
|
#
|
|
|
|
# The following are set after configuration is done:
|
|
|
|
# GOOGLETEST_FOUND
|
|
|
|
# LIBGTEST_DEV_DIR
|
|
|
|
# GTEST_INCLUDE_DIRS
|
|
|
|
|
2019-06-21 00:49:41 +00:00
|
|
|
if(NOT COMMAND feature_summary)
|
|
|
|
include(FeatureSummary)
|
|
|
|
endif()
|
|
|
|
|
2020-11-01 13:35:15 +00:00
|
|
|
if(NOT PKG_CONFIG_FOUND)
|
|
|
|
include(FindPkgConfig)
|
|
|
|
endif()
|
|
|
|
|
2019-06-19 21:42:46 +00:00
|
|
|
pkg_check_modules(PC_GTEST gtest)
|
2019-03-09 00:39:32 +00:00
|
|
|
|
2020-02-29 13:33:09 +00:00
|
|
|
if(NOT GTEST_DIR)
|
|
|
|
set(GTEST_DIR_USER_PROVIDED /usr/local)
|
|
|
|
else()
|
|
|
|
set(GTEST_DIR_USER_PROVIDED ${GTEST_DIR})
|
|
|
|
endif()
|
|
|
|
if(DEFINED ENV{GTEST_DIR})
|
|
|
|
set(GTEST_DIR_USER_PROVIDED
|
|
|
|
${GTEST_DIR_USER_PROVIDED}
|
|
|
|
$ENV{GTEST_DIR}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2019-03-09 00:39:32 +00:00
|
|
|
find_path(LIBGTEST_DEV_DIR
|
|
|
|
NAMES src/gtest-all.cc
|
|
|
|
PATHS
|
2020-02-29 13:33:09 +00:00
|
|
|
${GTEST_DIR_USER_PROVIDED}
|
|
|
|
${GTEST_DIR_USER_PROVIDED}/googletest
|
2019-03-09 00:39:32 +00:00
|
|
|
/usr/src/googletest/googletest
|
|
|
|
/usr/src/gtest
|
|
|
|
/usr/include/gtest
|
2019-09-30 12:58:34 +00:00
|
|
|
/usr/local/src/googletest/googletest
|
2019-03-09 00:39:32 +00:00
|
|
|
/opt/local/src/gtest-1.7.0
|
|
|
|
)
|
|
|
|
|
|
|
|
find_path(GTEST_INCLUDE_DIRS
|
|
|
|
NAMES gtest/gtest.h
|
2019-09-30 12:58:34 +00:00
|
|
|
HINTS ${PC_GTEST_INCLUDEDIR}
|
2019-03-09 00:39:32 +00:00
|
|
|
PATHS
|
2020-02-29 13:33:09 +00:00
|
|
|
${GTEST_DIR_USER_PROVIDED}/googletest/include
|
2019-03-09 00:39:32 +00:00
|
|
|
/usr/include
|
2019-09-30 12:58:34 +00:00
|
|
|
/usr/local/include
|
2019-03-09 00:39:32 +00:00
|
|
|
/opt/local/src/gtest-1.7.0/include
|
|
|
|
)
|
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(GOOGLETEST DEFAULT_MSG LIBGTEST_DEV_DIR GTEST_INCLUDE_DIRS)
|
2019-06-19 21:42:46 +00:00
|
|
|
|
|
|
|
if(GOOGLETEST_FOUND AND PC_GTEST_VERSION)
|
|
|
|
set(GOOGLETEST_VERSION ${PC_GTEST_VERSION})
|
2019-06-21 00:49:41 +00:00
|
|
|
set_package_properties(GOOGLETEST PROPERTIES
|
2019-06-25 09:48:00 +00:00
|
|
|
DESCRIPTION "Source code of Google's Testing Framework (found: v${GOOGLETEST_VERSION})"
|
2019-06-21 00:49:41 +00:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
set_package_properties(GOOGLETEST PROPERTIES
|
|
|
|
DESCRIPTION "Source code of Google's Testing Framework"
|
|
|
|
)
|
2019-06-19 21:42:46 +00:00
|
|
|
endif()
|
|
|
|
|
2019-06-21 00:49:41 +00:00
|
|
|
set_package_properties(GOOGLETEST PROPERTIES
|
|
|
|
URL "https://github.com/google/googletest"
|
|
|
|
)
|
|
|
|
|
2019-03-09 00:39:32 +00:00
|
|
|
mark_as_advanced(LIBGTEST_DEV_DIR GTEST_INCLUDE_DIRS)
|