Skip to content

Commit

Permalink
uncomment GTest cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
balos1 committed Nov 3, 2023
1 parent 504178f commit 82e5db6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
34 changes: 18 additions & 16 deletions cmake/SundialsSetupTesting.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -136,22 +136,24 @@ endif()

# Check if unit tests are enabled
if(SUNDIALS_TEST_UNITTESTS)
# message(WARNING "Could not find Google Test so we are cloning it from GitHub...")
# include(FetchContent)
# FetchContent_Declare(
# googletest
# URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
# )
# if(WIN32)
# # For Windows: Prevent overriding the parent project's compiler/linker settings
# set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
# endif()
# FetchContent_GetProperties(googletest)
# if(NOT googletest_POPULATED)
# FetchContent_Populate(googletest)
# add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
# endif()
# include(GoogleTest)
find_package(GTest)
if(NOT TARGET GTest::gtest_main)
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)
if(WIN32)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
endif()
FetchContent_GetProperties(googletest)
if(NOT googletest_POPULATED)
FetchContent_Populate(googletest)
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
endif()
include(GoogleTest)
endif()
endif()

# If examples are installed, create post install smoke test targets
Expand Down
6 changes: 3 additions & 3 deletions test/unit_tests/sundials/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
# SUNDIALS Copyright End
# ---------------------------------------------------------------

# add_executable(test_sundials_errors test_sundials_errors.cpp)
# target_link_libraries(test_sundials_errors PRIVATE sundials_generic GTest::gtest_main GTest::gmock)
# gtest_discover_tests(test_sundials_errors)
add_executable(test_sundials_errors test_sundials_errors.cpp)
target_link_libraries(test_sundials_errors PRIVATE sundials_generic GTest::gtest_main GTest::gmock)
gtest_discover_tests(test_sundials_errors)

add_subdirectory(reductions)

0 comments on commit 82e5db6

Please sign in to comment.