mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-10-16 19:05:05 +00:00
Introduce four CMake options to enable/disabled test variants or test frameworks
By default all four test variants (Catch2 vs. GTest and Approval vs. Unit) are enabled.
This commit is contained in:
1 parent
afd4627ee1
commit
784920714a
8 files changed
+127
-92
No files matched your search
+26
-20
@@ -1,29 +1,35 @@
|
||||
include(FetchContent)
|
||||
|
||||
FetchContent_Declare(
|
||||
googletest
|
||||
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||
GIT_TAG v1.16.0
|
||||
GIT_SHALLOW TRUE
|
||||
)
|
||||
if (BUILD_APPROVAL_TESTS_WITH_GTEST OR BUILD_UNIT_TESTS_WITH_GTEST)
|
||||
FetchContent_Declare(
|
||||
googletest
|
||||
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||
GIT_TAG v1.16.0
|
||||
GIT_SHALLOW TRUE
|
||||
)
|
||||
FetchContent_MakeAvailable(googletest)
|
||||
endif()
|
||||
|
||||
FetchContent_Declare(
|
||||
catch2
|
||||
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
||||
GIT_TAG v3.8.0
|
||||
GIT_SHALLOW TRUE
|
||||
)
|
||||
if (BUILD_APPROVAL_TESTS_WITH_CATCH2 OR BUILD_UNIT_TESTS_WITH_CATCH2)
|
||||
FetchContent_Declare(
|
||||
catch2
|
||||
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
||||
GIT_TAG v3.8.0
|
||||
GIT_SHALLOW TRUE
|
||||
)
|
||||
FetchContent_MakeAvailable(catch2)
|
||||
endif()
|
||||
|
||||
FetchContent_MakeAvailable(googletest catch2)
|
||||
if (BUILD_APPROVAL_TESTS_WITH_GTEST OR BUILD_UNIT_TESTS_WITH_GTEST)
|
||||
# Force Google Test to link the C/C++ runtimes dynamically
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
|
||||
# Force Google Test to link the C/C++ runtimes dynamically
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
# Disable building GMock
|
||||
set(BUILD_GMOCK OFF CACHE BOOL "" FORCE)
|
||||
|
||||
# Disable building GMock
|
||||
set(BUILD_GMOCK OFF CACHE BOOL "" FORCE)
|
||||
|
||||
# Do not install GTest
|
||||
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
|
||||
# Do not install GTest
|
||||
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
|
||||
add_subdirectory(cpp_catch2_approvaltest)
|
||||
add_subdirectory(cpp_catch2_unittest)
|
||||
|
||||
Reference in new issue
Block a user