Skip to content

Commit

Permalink
update FetchContent for googletest
Browse files Browse the repository at this point in the history
  • Loading branch information
hurchalla committed Jul 5, 2024
1 parent 149e695 commit 502b49e
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions test/FetchGoogleTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,18 @@ if (NOT TARGET gtest_main)
GIT_TAG main
)
#git tag of release-1.8.0 instead?
FetchContent_GetProperties(googletest)
if(NOT googletest_POPULATED)
FetchContent_Populate(googletest)
endif()


# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)

# OLD METHOD (deprecated):
#
# FetchContent_GetProperties(googletest)
# if(NOT googletest_POPULATED)
# FetchContent_Populate(googletest)
# endif()


# set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL ON)
Expand All @@ -44,7 +52,12 @@ if (NOT TARGET gtest_main)
# set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME googletest)

# add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL)



# add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL)



# alternative
# set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE BOOL "")
Expand Down

0 comments on commit 502b49e

Please sign in to comment.