build: warn about building into sources' dir

If you build in the source tree, you'll fill the sources with objects and create a mess.
Please prefer to build outside sources tree into a temporary place,

prefer :
   cmake build

to :
   cmake .

But If you trust your build tools and cleanup is done on each build
you can use current dir without any risk.

Bug: https://github.com/intel-iot-devkit/upm/pull/75
Change-Id: Ieb914ca359047df8b5dba1c2174e6c61e4526677
Signed-off-by: Philippe Coval <philippe.coval@open.eurogiciel.org>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
Philippe Coval 2015-01-29 09:29:58 +01:00 committed by Mihai Tudor Panu
parent c9792b4e62
commit ba33366d45

View File

@ -1,6 +1,10 @@
cmake_minimum_required (VERSION 2.8.11) cmake_minimum_required (VERSION 2.8.11)
project (upm) project (upm)
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message("WARNING: building into sources dir can be risky, prefer other directory")
endif ()
find_package (SWIG) find_package (SWIG)
if (SWIG_FOUND) if (SWIG_FOUND)
include (${SWIG_USE_FILE}) include (${SWIG_USE_FILE})