-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clone the github by git and allow users to select gtest manually
There are reports saying clonning gtest all the time may failure in case of bad network condition. So we tried to improve this by clonning with git protocal and allow users to specify the gtest manually. See the updated documents for details.
- Loading branch information
1 parent
ce035dc
commit 7690a05
Showing
3 changed files
with
31 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
message(STATUS "fetch GTest from https://github.com/google/googletest.git") | ||
include(FetchContent) | ||
FetchContent_Declare( | ||
googletest | ||
GIT_REPOSITORY https://github.com/google/googletest.git | ||
GIT_TAG release-1.11.0 | ||
) | ||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) | ||
set(BUILD_GMOCK ON CACHE BOOL "" FORCE) | ||
set(BUILD_GTEST ON CACHE BOOL "" FORCE) | ||
FetchContent_MakeAvailable(googletest) | ||
set(GMOCK_INCLUDE_DIR ${CMAKE_BINARY_DIR}/_deps/googletest-src/googlemock/include/) | ||
set(GTEST_INCLUDE_DIR ${CMAKE_BINARY_DIR}/_deps/googletest-src/googletest/include/) | ||
set(GTEST_LIBRARIES gtest_main) | ||
set(GMOCK_LIBRARIES gmock_main) | ||
if (DEFINED GMOCK_INCLUDE_DIR AND DEFINED GTEST_INCLUDE_DIR | ||
AND DEFINED GTEST_LIBRARIES AND DEFINED GMOCK_LIBRARIES) | ||
message(STATUS "Using GTest from specified path") | ||
else() | ||
message(STATUS "Not all GTest variable got specified: " | ||
"'GMOCK_INCLUDE_DIR', 'GTEST_INCLUDE_DIR', " | ||
"'GTEST_LIBRARIES', 'GMOCK_LIBRARIES'") | ||
message(STATUS "fetch GTest from [email protected]:google/googletest.git") | ||
include(FetchContent) | ||
FetchContent_Declare( | ||
googletest | ||
GIT_REPOSITORY [email protected]:google/googletest.git | ||
GIT_TAG release-1.11.0 | ||
) | ||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) | ||
set(BUILD_GMOCK ON CACHE BOOL "" FORCE) | ||
set(BUILD_GTEST ON CACHE BOOL "" FORCE) | ||
FetchContent_MakeAvailable(googletest) | ||
set(GMOCK_INCLUDE_DIR ${CMAKE_BINARY_DIR}/_deps/googletest-src/googlemock/include/) | ||
set(GTEST_INCLUDE_DIR ${CMAKE_BINARY_DIR}/_deps/googletest-src/googletest/include/) | ||
set(GTEST_LIBRARIES gtest_main) | ||
set(GMOCK_LIBRARIES gmock_main) | ||
endif() | ||
|
||
message(STATUS "GTest: ${GTEST_INCLUDE_DIR}, ${GTEST_LIBRARIES}") | ||
message(STATUS "GMock: ${GMOCK_INCLUDE_DIR}, ${GMOCK_LIBRARIES}") |