File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ include(ExternalProject)
5
5
# User-configurable options.
6
6
option (BUILD_JSONNET "Build jsonnet command-line tool." ON )
7
7
option (BUILD_TESTS "Build and run jsonnet tests." ON )
8
+ option (USE_SYSTEM_GTEST "Use system-provided gtest library" OFF )
8
9
set (GLOBAL_OUTPUT_PATH_SUFFIX "" CACHE STRING
9
10
"Output artifacts directory." )
10
11
@@ -33,7 +34,7 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${GLOBAL_OUTPUT_PATH})
33
34
# known locations on the local machine. Downloading the library ourselves
34
35
# allows us to pin to a specific version and makes things easier for users
35
36
# who don't have package managers.
36
- if (BUILD_TESTS )
37
+ if (BUILD_TESTS AND NOT USE_SYSTEM_GTEST )
37
38
enable_testing ()
38
39
39
40
# Generate and download googletest project.
@@ -66,6 +67,10 @@ if (BUILD_TESTS)
66
67
67
68
# Include googletest headers.
68
69
include_directories ("${gtest_SOURCE_DIR} /include" )
70
+
71
+ elseif (BUILD_TESTS AND USE_SYSTEM_GTEST )
72
+ enable_testing ()
73
+ add_subdirectory (/usr/src/googletest ${GLOBAL_OUTPUT_PATH} /googletest-build )
69
74
endif ()
70
75
71
76
# Compiler flags.
You can’t perform that action at this time.
0 commit comments