GoogleTest 1.14.0 when C++14 compiler available
This commit is contained in:
parent
9bc6befee7
commit
a76885dfac
2 changed files with 25 additions and 1 deletions
|
|
@ -7,6 +7,7 @@
|
|||
shared library otherwise; that is the same pattern followed by opencv.
|
||||
The variable should be explicitly set to `ON` if a shared library must
|
||||
be created, and `OFF` if a static library must be created.
|
||||
- Use GoogleTest 1.14.0 and enable tests only when C++14 compiler available.
|
||||
|
||||
## 0.9.0
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,26 @@
|
|||
# googletest
|
||||
# ----------
|
||||
#
|
||||
# The 1.14.x branch requires at least C++14.
|
||||
#
|
||||
# In particular, 19.34+ (MSVC 2022) is required for Visual Studio:
|
||||
# Avoid GoogleTest 1.14.0 error:
|
||||
# [build] C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\yvals_core.h(811):
|
||||
# error STL1001: Unexpected compiler version, expected MSVC 19.34 or newer.
|
||||
# [build] C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\yvals_core.h(811):
|
||||
# error C2338: Error in C++ Standard Library usage.
|
||||
# [build] C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\type_traits(1767):
|
||||
# error C2275: '_Ty1': illegal use of this type as an expression
|
||||
if(MSVC)
|
||||
if(MSVC_VERSION LESS 1934)
|
||||
message(STATUS "Tests skipped because MSVC 19.34+ (MSVC 2022) is needed for GoogleTest 1.14+")
|
||||
return()
|
||||
endif()
|
||||
elseif(NOT "cxx_std_14" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
|
||||
message(STATUS "Tests skipped because C++14 is needed for GoogleTest 1.14+")
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(googletest
|
||||
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||
|
|
@ -5,8 +28,8 @@ FetchContent_Declare(googletest
|
|||
)
|
||||
FetchContent_MakeAvailable(googletest)
|
||||
|
||||
include(GoogleTest)
|
||||
add_executable(c-capnproto-testcases addressbook.capnp.c capn-stream-test.cpp capn-test.cpp example-test.cpp)
|
||||
target_link_libraries(c-capnproto-testcases PRIVATE CapnC_Runtime GTest::gtest)
|
||||
|
||||
include(GoogleTest)
|
||||
gtest_add_tests(TARGET c-capnproto-testcases)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue