File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ cmake_minimum_required( VERSION 2.6 )
33project ( scitokens-cpp )
44
55option ( BUILD_UNITTESTS "Build the scitokens-cpp unit tests" OFF )
6+ option ( EXTERNAL_GTEST "Use an external/pre-installed copy of GTest" OFF )
67
78set ( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR} /cmake )
89
@@ -75,13 +76,14 @@ if (NOT DEFINED INCLUDE_INSTALL_DIR)
7576endif ()
7677
7778if ( BUILD_UNITTESTS )
78-
79+ if ( NOT EXTERNAL_GTEST )
7980include (ExternalProject)
8081ExternalProject_Add(gtest
8182 PREFIX external/gtest
82- URL file:// ${PROJECT_SOURCE_DIR } /vendor/gtest
83+ URL ${CMAKE_CURRENT_SOURCE_DIR } /vendor/gtest
8384 INSTALL_COMMAND :
8485)
86+ endif ()
8587enable_testing ()
8688add_subdirectory (test )
8789endif ()
Original file line number Diff line number Diff line change @@ -3,7 +3,13 @@ add_executable(scitokens-gtest main.cpp)
33add_dependencies (scitokens-gtest gtest)
44include_directories ("${PROJECT_SOURCE_DIR} /vendor/gtest/googletest/include" )
55
6- target_link_libraries (scitokens-gtest SciTokens "${CMAKE_BINARY_DIR} /external/gtest/src/gtest-build/lib/libgtest.a" -lpthread)
6+ if (EXTERNAL_GTEST)
7+ set (LIBGTEST "gtest" )
8+ else ()
9+ set (LIBGTEST "${CMAKE_BINARY_DIR} /external/gtest/src/gtest-build/lib/libgtest.a" )
10+ endif ()
11+
12+ target_link_libraries (scitokens-gtest SciTokens "${LIBGTEST} " pthread)
713
814add_test (
915 NAME
You can’t perform that action at this time.
0 commit comments