Skip to content

Commit 0d821c9

Browse files
ventZldanielinux
authored andcommitted
CMake: Reject in-source build
Check for in-source build and reject it.
1 parent 6fdb4dd commit 0d821c9

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
cmake_minimum_required(VERSION 3.16)
22

3+
#---------------------------------------------------------------------------------------------
4+
# First, ensure no in-source build occurs.
5+
#---------------------------------------------------------------------------------------------
6+
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
7+
message(FATAL_ERROR
8+
"In-source builds are not allowed for wolfIP.\
9+
Run cmake from a separate directory from where CMakeLists.txt lives.")
10+
endif()
11+
312
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
413

514
set(CMAKE_C_FLAGS "-Wall -Werror -Wextra -Wdeclaration-after-statement")

0 commit comments

Comments
 (0)