Skip to content

Commit ca413ed

Browse files
authored
Simplify and unify gtest build (learning-process#630)
- Disable gmock - Pass existing cmake variables if available - Use `-Dgtest_force_shared_crt` only for gtest instead of the whole project
1 parent 97a391e commit ca413ed

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

cmake/configure.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
if(MSVC)
2-
option(gtest_force_shared_crt "" TRUE)
3-
endif(MSVC)
4-
51
if(NOT CMAKE_BUILD_TYPE)
62
set(CMAKE_BUILD_TYPE "Release")
73
endif(NOT CMAKE_BUILD_TYPE)

cmake/gtest.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ ExternalProject_Add(
1111
-DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER}
1212
-DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}
1313
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
14-
-DCMAKE_CXX_STANDARD_REQUIRED=ON
14+
-DCMAKE_CXX_STANDARD_REQUIRED=${CMAKE_CXX_STANDARD_REQUIRED}
1515
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
1616
-DCMAKE_C_FLAGS=-w
1717
-DCMAKE_CXX_FLAGS=-w
18+
-DBUILD_GMOCK=OFF
1819
$<$<BOOL:MSVC>:-Dgtest_force_shared_crt=ON>
1920
BUILD_COMMAND
2021
"${CMAKE_COMMAND}" --build

0 commit comments

Comments
 (0)