Skip to content

Commit

Permalink
make tests optional;
Browse files Browse the repository at this point in the history
  • Loading branch information
NateSeymour committed Jan 29, 2025
1 parent f462ab0 commit 28c3e65
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ FetchContent_Declare(
)
FetchContent_MakeAvailable(ctre)

FetchContent_Declare(
GTEST
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG main
)
FetchContent_MakeAvailable(GTEST)

# Buffalo
add_library(buffalo INTERFACE
include/buffalo/buffalo.h
Expand All @@ -27,11 +20,21 @@ target_include_directories(buffalo INTERFACE include)
target_link_libraries(buffalo INTERFACE ctre::ctre)

# Tests
add_executable(buffalo-test
test/buffalo.test.cpp
)
target_link_libraries(buffalo-test PRIVATE buffalo GTest::gtest_main)
target_include_directories(buffalo-test PRIVATE include)
option(BUFFALO_ENABLE_TESTS "Include googletest and enable test target" ON)
if(BUFFALO_ENABLE_TESTS)
FetchContent_Declare(
GTEST
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG main
)
FetchContent_MakeAvailable(GTEST)

add_executable(buffalo-test
test/buffalo.test.cpp
)
target_link_libraries(buffalo-test PRIVATE buffalo GTest::gtest_main)
target_include_directories(buffalo-test PRIVATE include)
endif()

# Examples
add_executable(example-calculator
Expand Down

0 comments on commit 28c3e65

Please sign in to comment.