Skip to content

Commit 3046f97

Browse files
authored
Block running cmake targeting root directory (#403)
If you run raw `cmake` it messes up the root directory. ASAIK there is no way to default to certain directory, so it should not be allowed. This PR makes `cmake` block such runs ## Pre-review checklist - [x] I have split my patch into logically separate commits. - [x] All commit messages clearly explain what they change and why. - [x] PR description sums up the changes and reasons why they should be introduced. - [ ] ~~I have implemented Rust unit tests for the features/changes introduced.~~ - [ ] ~~I have enabled appropriate tests in `Makefile` in `{SCYLLA,CASSANDRA}_(NO_VALGRIND_)TEST_FILTER`.~~ - [ ] ~~I added appropriate `Fixes:` annotations to PR description.~~
2 parents 36cf4a0 + 30abd0e commit 3046f97

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ log/
1111
docs/source/api
1212
doxygen/xml
1313

14+
# Leftovers from manually running `cmake`
15+
CMakeCache.txt
16+
CMakeFiles/
17+
1418
# Codex / MCP
1519
.codex/
1620
.codex-cache/

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ option(CASS_USE_LIBUV "Use libuv" OFF)
5151

5252
set(CASS_CPP_STANDARD "11" CACHE STRING "C++ standard (11, 14, 17, etc.)")
5353

54+
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
55+
message(FATAL_ERROR
56+
"In-source builds are not allowed.\n"
57+
"Use: cmake -S . -B build"
58+
)
59+
endif()
60+
5461
if(CASS_BUILD_SHARED)
5562
set(BUILD_SHARED_LIBS ON)
5663
endif()

0 commit comments

Comments
 (0)