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
@@ -69,13 +70,14 @@ add_executable(scitokens-create src/create.cpp)
6970target_link_libraries (scitokens-create SciTokens)
7071
7172if ( BUILD_UNITTESTS )
72-
73+ if ( NOT EXTERNAL_GTEST )
7374include (ExternalProject)
7475ExternalProject_Add(gtest
7576 PREFIX external/gtest
76- URL file:// ${PROJECT_SOURCE_DIR } /vendor/gtest
77+ URL ${CMAKE_CURRENT_SOURCE_DIR } /vendor/gtest
7778 INSTALL_COMMAND :
7879)
80+ endif ()
7981enable_testing ()
8082add_subdirectory (test )
8183endif ()
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