This commit extracts GTestSource package from GTest package.
Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
option(DOWNLOAD_ONNX "Download ONNX source" ON)
option(DOWNLOAD_ABSEIL "Download Abseil-cpp source" ON)
-option(BUILD_GTEST "Download and build Google Test" ON)
+option(DOWNLOAD_GTEST "Download Google Test source" ON)
+option(BUILD_GTEST "Build Google Test from the downloaded source" ON)
nncc_find_package(GTest QUIET)
nncc_include(ExternalProjectTools)
nncc_include(OptionTools)
- envoption(GTEST_URL https://github.com/google/googletest/archive/release-1.8.0.tar.gz)
-
- ExternalSource_Download(GTEST ${GTEST_URL})
+ # TODO Check this later
+ nncc_find_package(GTestSource REQUIRED)
if(NOT TARGET gtest_main)
- add_extdirectory(${GTEST_SOURCE_DIR} gtest)
+ add_extdirectory(${GTestSource_DIR} gtest)
endif(NOT TARGET gtest_main)
set(GTest_FOUND TRUE)
--- /dev/null
+function(_GTestSource_import)
+ if(NOT DOWNLOAD_GTEST)
+ set(GTestSource_FOUND FALSE PARENT_SCOPE)
+ return()
+ endif(NOT DOWNLOAD_GTEST)
+
+ nncc_include(ExternalSourceTools)
+ nncc_include(OptionTools)
+
+ envoption(GTEST_URL https://github.com/google/googletest/archive/release-1.8.0.tar.gz)
+
+ ExternalSource_Download(GTEST ${GTEST_URL})
+
+ set(GTestSource_DIR ${GTEST_SOURCE_DIR} PARENT_SCOPE)
+ set(GTestSource_FOUND TRUE PARENT_SCOPE)
+endfunction(_GTestSource_import)
+
+_GTestSource_import()