Skip to content

Commit f77e9bc

Browse files
committed
Merge pull request opencv#8582 from alalek:cmake_disable_insource_builds
2 parents 8a16997 + a07d8a8 commit f77e9bc

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
#
77
# ----------------------------------------------------------------------------
88

9+
# Disable in-source builds to prevent source tree corruption.
10+
if(" ${CMAKE_SOURCE_DIR}" STREQUAL " ${CMAKE_BINARY_DIR}")
11+
message(FATAL_ERROR "
12+
FATAL: In-source builds are not allowed.
13+
You should create separate directory for build files.
14+
")
15+
endif()
916

1017

1118
include(cmake/OpenCVMinDepVersions.cmake)
@@ -1397,13 +1404,6 @@ status("")
13971404

13981405
ocv_finalize_status()
13991406

1400-
# ----------------------------------------------------------------------------
1401-
# Warn in the case of in-source build
1402-
# ----------------------------------------------------------------------------
1403-
if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
1404-
message(WARNING "The source directory is the same as binary directory. \"make clean\" may damage the source tree")
1405-
endif()
1406-
14071407
# ----------------------------------------------------------------------------
14081408
# CPack stuff
14091409
# ----------------------------------------------------------------------------

0 commit comments

Comments
 (0)