cmake: add googletest via FetchContent
This commit is contained in:
parent
a6bc4d1329
commit
a679f8aca7
1 changed files with 17 additions and 0 deletions
|
@ -17,6 +17,23 @@ set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "ON")
|
|||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
option(MNODE_BUILD_TESTS "Build mnode test binaries" ${MESYTEC_MNODE_MAIN_PROJECT})
|
||||
|
||||
if (MNODE_BUILD_TESTS)
|
||||
find_package(GTest CONFIG)
|
||||
if (NOT GTest_FOUND)
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(googletest URL https://github.com/google/googletest/archive/refs/tags/v1.15.2.zip)
|
||||
# For Windows: Prevent overriding the parent project's compiler/linker settings
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
FetchContent_MakeAvailable(googletest)
|
||||
endif()
|
||||
|
||||
message("-- mnode: Building tests")
|
||||
include(CTest)
|
||||
enable_testing()
|
||||
endif()
|
||||
|
||||
include(CMakeRC)
|
||||
cmrc_add_resource_library(mnode-resources
|
||||
ALIAS mnode::resources NAMESPACE mnode::resources
|
||||
|
|
Loading…
Reference in a new issue