Skip to content

Commit 826c84b

Browse files
committed
Add a submodule for googletest.
Include as an external CMake project.
1 parent 5b22a53 commit 826c84b

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

.gitmodules

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
[submodule "vendor/jwt-cpp"]
22
path = vendor/jwt-cpp
33
url = https://github.com/Thalhammer/jwt-cpp.git
4+
5+
[submodule "vendor/gtest"]
6+
path = vendor/gtest
7+
url = https://github.com/google/googletest.git
8+
branch = v1.8.x

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
cmake_minimum_required( VERSION 2.6 )
33
project( scitokens-cpp )
44

5+
option( BUILD_UNITTESTS "Build the scitokens-cpp unit tests" OFF )
6+
57
set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake )
68

79
find_package( jwt-cpp REQUIRED )
@@ -68,6 +70,19 @@ if (NOT DEFINED INCLUDE_INSTALL_DIR)
6870
SET(INCLUDE_INSTALL_DIR "include")
6971
endif()
7072

73+
if( BUILD_UNITTESTS )
74+
75+
include(ExternalProject)
76+
ExternalProject_Add(gtest
77+
PREFIX external/gtest
78+
SOURCE_DIR ${PROJECT_SOURCE_DIR}/vendor/gtest
79+
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/external/gtest/src/gtest-build/lib/libgtest.a
80+
INSTALL_COMMAND :
81+
)
82+
83+
enable_testing()
84+
endif()
85+
7186
install(
7287
TARGETS SciTokens
7388
LIBRARY DESTINATION ${LIB_INSTALL_DIR} )

vendor/gtest

Submodule gtest added at c27aceb

0 commit comments

Comments
 (0)