Skip to content

Commit

Permalink
CMake: prevent in-source builds (AMReX-Codes#1453)
Browse files Browse the repository at this point in the history
* CMake: prevent in-source builds

* CMake: make error message more detailed
  • Loading branch information
mic84 authored Oct 15, 2020
1 parent c53b1bb commit 15643f4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
cmake_minimum_required(VERSION 3.14)

#
# Prevent in-source builds
#
if (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
message(FATAL_ERROR
"\nin-source builds are not allowed: "
"build directory cannot be in the source directory path!\n"
"You MUST remove the file ${CMAKE_BINARY_DIR}/CMakeCache.txt and "
" the directory ${CMAKE_BINARY_DIR}/CMakeFiles/ to be able to build again.")
endif ()


########################################################################
#
# Set variables for AMReX versioning
Expand Down

0 comments on commit 15643f4

Please sign in to comment.