Skip to content

Commit

Permalink
GHI #13 Prevent in-source build of tests
Browse files Browse the repository at this point in the history
Signed-off-by: doodspav <[email protected]>
  • Loading branch information
doodspav committed Mar 18, 2023
1 parent 45fdb60 commit ae67297
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 1 addition & 2 deletions cmake/util/PreventInSourceBuilds.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(
FATAL_ERROR
"In-source builds are not supported. "
"Please read the BUILDING document before trying to build this project. "
"You may need to delete 'CMakeCache.txt' and 'CMakeFiles/' first."
"You may need to delete 'CMakeCache.txt' and 'CMakeFiles/' before rebuilding this project."
)
endif()
2 changes: 2 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.14)

include(cmake/PreventInSourceBuilds.cmake)

project(
patomic_test
DESCRIPTION "Standalone tests for patomic library"
Expand Down
8 changes: 8 additions & 0 deletions test/cmake/PreventInSourceBuilds.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# in-source build guard
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(
FATAL_ERROR
"In-source builds are not supported. "
"You may need to delete 'CMakeCache.txt' and 'CMakeFiles/' before rebuilding this project."
)
endif()

0 comments on commit ae67297

Please sign in to comment.