Skip to content

Commit bed2145

Browse files
Copilotwdconinc
andcommitted
Use standard BUILD_TESTING option with defensive check
Changed from BUILD_MOLLERDB_TESTS to BUILD_TESTING with CMAKE_PROJECT_NAME check to match sqlpp23 pattern. This prevents tests from being built when mollerdb is used as a subproject. Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com>
1 parent 020b3bc commit bed2145

5 files changed

Lines changed: 8 additions & 8 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ jobs:
132132
run: |
133133
mkdir -p build
134134
cd build
135-
cmake .. -DBUILD_MOLLERDB_TESTS=ON
135+
cmake .. -DBUILD_TESTING=ON
136136
cmake --build . --target test_database
137137
ctest --output-on-failure -V
138138
env:

AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ make
8080
**Building with Tests:**
8181
```bash
8282
mkdir build && cd build
83-
cmake .. -DBUILD_MOLLERDB_TESTS=ON
83+
cmake .. -DBUILD_TESTING=ON
8484
cmake --build .
8585
ctest --output-on-failure
8686
```
@@ -230,7 +230,7 @@ pytest tests/python/ -v
230230
**C++ Tests (Google Test via CTest):**
231231
```bash
232232
mkdir build && cd build
233-
cmake .. -DBUILD_MOLLERDB_TESTS=ON
233+
cmake .. -DBUILD_TESTING=ON
234234
cmake --build .
235235
ctest --output-on-failure
236236
```

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ set(BUILD_TESTING OFF CACHE BOOL "Build tests" FORCE)
6868
add_subdirectory(thirdparty/sqlpp23)
6969

7070
# --- Testing ---
71-
# Enable testing for this project (separate from sqlpp23's BUILD_TESTING)
72-
option(BUILD_MOLLERDB_TESTS "Build mollerdb tests" ON)
71+
# Enable testing for this project (only when mollerdb is the top-level project)
72+
option(BUILD_TESTING "Build mollerdb tests" ON)
7373

74-
if(BUILD_MOLLERDB_TESTS)
74+
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
7575
enable_testing()
7676

7777
# Fetch Google Test

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ The C++ tests use Google Test and are built with CMake:
239239
```bash
240240
# Build with tests enabled
241241
mkdir build && cd build
242-
cmake .. -DBUILD_MOLLERDB_TESTS=ON
242+
cmake .. -DBUILD_TESTING=ON
243243
cmake --build .
244244

245245
# Run all C++ tests

tests/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Build and run C++ tests using CMake and CTest:
2626
```bash
2727
# From repository root
2828
mkdir build && cd build
29-
cmake .. -DBUILD_MOLLERDB_TESTS=ON
29+
cmake .. -DBUILD_TESTING=ON
3030
cmake --build .
3131
ctest --output-on-failure
3232
```

0 commit comments

Comments
 (0)