Skip to content

Commit 3fe750f

Browse files
committed
fix: don't include test framework in build
1 parent 879b573 commit 3fe750f

3 files changed

Lines changed: 18 additions & 10 deletions

File tree

.github/workflows/test-macos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
run: brew install cmake sdl2
2929

3030
- name: Configure
31-
run: cmake -B build
31+
run: cmake -B build -DBUILD_ROBOT_TESTS=ON
3232

3333
- name: Build
3434
run: cmake --build build

.github/workflows/test-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
4444
- name: Configure with vcpkg
4545
run: |
46-
cmake -B build -DCMAKE_TOOLCHAIN_FILE="$PWD/vcpkg/scripts/buildsystems/vcpkg.cmake"
46+
cmake -B build -DCMAKE_TOOLCHAIN_FILE="$PWD/vcpkg/scripts/buildsystems/vcpkg.cmake" -DBUILD_ROBOT_TESTS=ON
4747
4848
- name: Build
4949
run: cmake --build build --config Release

CMakeLists.txt

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@ set(CMAKE_CXX_EXTENSIONS OFF)
99
# Library name
1010
set(LIB_NAME RobotCPP)
1111

12-
# Add GoogleTest
13-
add_subdirectory(externals/googletest)
14-
enable_testing()
12+
# Option to build tests (OFF by default)
13+
option(BUILD_ROBOT_TESTS "Build the RobotCPP tests" OFF)
1514

16-
# Find SDL2 for tests
17-
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/sdl2/")
18-
find_package(SDL2 REQUIRED)
15+
# Only find dependencies and add GoogleTest if tests are enabled
16+
if(BUILD_ROBOT_TESTS)
17+
# Add GoogleTest
18+
add_subdirectory(externals/googletest)
19+
enable_testing()
20+
21+
# Find SDL2 for tests
22+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/sdl2/")
23+
find_package(SDL2 REQUIRED)
24+
endif()
1925

2026
# Compiler-specific options
2127
if(MSVC)
@@ -64,5 +70,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
6470
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin)
6571
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin)
6672

67-
# Add the tests directory
68-
add_subdirectory(tests)
73+
# Add the tests directory only if tests are enabled
74+
if(BUILD_ROBOT_TESTS)
75+
add_subdirectory(tests)
76+
endif()

0 commit comments

Comments
 (0)