[opencv] 46/53: cmake: disallow in-source builds

Nobuhiro Iwamatsu iwamatsu at moszumanska.debian.org
Sun Aug 27 23:27:07 UTC 2017


This is an automated email from the git hooks/post-receive script.

iwamatsu pushed a commit to annotated tag 2.4.13.3
in repository opencv.

commit 777a0080cbdb98761853519b3f45136727a855c2
Author: Alexander Alekhin <alexander.alekhin at intel.com>
Date:   Sat Apr 15 06:55:46 2017 +0300

    cmake: disallow in-source builds
---
 CMakeLists.txt | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3f2ceb9..084399f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,11 +4,16 @@
 #    From the off-tree build directory, invoke:
 #      $ cmake <PATH_TO_OPENCV_ROOT>
 #
-#
-#   - OCT-2008: Initial version <joseluisblancoc at gmail.com>
-#
 # ----------------------------------------------------------------------------
 
+# Disable in-source builds to prevent source tree corruption.
+if(" ${CMAKE_SOURCE_DIR}" STREQUAL " ${CMAKE_BINARY_DIR}")
+  message(FATAL_ERROR "
+FATAL: In-source builds are not allowed.
+       You should create separate directory for build files.
+")
+endif()
+
 set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
 
 # Following block can broke build in case of cross-compilng
@@ -1095,13 +1100,6 @@ status("")
 ocv_finalize_status()
 
 # ----------------------------------------------------------------------------
-# Warn in the case of in-source build
-# ----------------------------------------------------------------------------
-if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
-  message(WARNING "The source directory is the same as binary directory. \"make clean\" may damage the source tree")
-endif()
-
-# ----------------------------------------------------------------------------
 # CPack stuff
 # ----------------------------------------------------------------------------
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opencv.git



More information about the debian-science-commits mailing list