File: googletest.cmake

package info (click to toggle)
srt 1.4.2-1.3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,648 kB
  • sloc: cpp: 42,817; ansic: 4,060; tcl: 916; sh: 146; python: 87; makefile: 49
file content (32 lines) | stat: -rw-r--r-- 824 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
# the following code to fetch googletest
# is inspired by and adapted after https://crascit.com/2015/07/25/cmake-gtest/
# download and unpack googletest at configure time

macro(fetch_googletest _download_module_path _download_root)
	set(GOOGLETEST_DOWNLOAD_ROOT ${_download_root})
	configure_file(
		${_download_module_path}/googletest-download.cmake
		${_download_root}/CMakeLists.txt
		@ONLY
		)
	unset(GOOGLETEST_DOWNLOAD_ROOT)

	execute_process(
		COMMAND
			"${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
		WORKING_DIRECTORY
			${_download_root}
		)
	execute_process(
		COMMAND
			"${CMAKE_COMMAND}" --build .
		WORKING_DIRECTORY
			${_download_root}
		)

	# adds the targers: gtest, gtest_main, gmock, gmock_main
	add_subdirectory(
		${_download_root}/googletest-src
		${_download_root}/googletest-build
		)
endmacro()