forked from numenta/nupic.core-legacy
-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathgtest.cmake
More file actions
64 lines (55 loc) · 2.11 KB
/
Copy pathgtest.cmake
File metadata and controls
64 lines (55 loc) · 2.11 KB
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
57
58
59
60
61
62
63
64
# -----------------------------------------------------------------------------
# HTM Community Edition of NuPIC
# Copyright (C) 2021, Numenta, Inc.
# modified 4/4/2022 - newer version
# modified 12/12/2024 - use FetchContent, David Keeney dkeeney@gmail.com
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Affero Public License for more details.
#
# You should have received a copy of the GNU Affero Public License
# along with this program. If not, see http://www.gnu.org/licenses.
# -----------------------------------------------------------------------------
#
# This will download the gtest module.
# exports 'gtest' as a target
#
include(FetchContent)
#
set(dependency_url "https://github.com/google/googletest/releases/download/v1.15.2/googletest-1.15.2.tar.gz")
set(local_override "${CMAKE_SOURCE_DIR}/build/Thirdparty/gtest")
# Check if local path exists and if so, use it as-is.
if(EXISTS ${local_override})
message(STATUS " Obtaining gtest from local override: ${local_override}")
FetchContent_Declare(
gtest
SOURCE_DIR ${local_override}
EXCLUDE_FROM_ALL
QUIET
)
else()
message(STATUS " Obtaining gtest from: ${dependency_url}")
FetchContent_Declare(
gtest
URL ${dependency_url}
EXCLUDE_FROM_ALL
QUIET
)
endif()
# Make sure that GTest does not try to install itself
set(INSTALL_GTEST OFF)
set(BUILD_GMOCK OFF)
FetchContent_MakeAvailable(gtest)
# For Windows: Prevent overriding the parent project's compiler/linker settings.
# This will force generation of a shared library for gtest.
if(MSVC)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
endif()
set_target_properties(gtest_main PROPERTIES EXCLUDE_FROM_ALL TRUE) # for gtest_main (not used)
set(gtest_INCLUDE_DIR "${gtest_SOURCE_DIR}/googletest/include")