You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@corinthia.apache.org by pm...@apache.org on 2015/08/10 09:39:33 UTC

incubator-corinthia git commit: Add CMake check to prevent building in source dir

Repository: incubator-corinthia
Updated Branches:
  refs/heads/master 4248d6155 -> 4420811a4


Add CMake check to prevent building in source dir


Project: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/commit/4420811a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/tree/4420811a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/diff/4420811a

Branch: refs/heads/master
Commit: 4420811a4a86fc67dfd74372239262a5a523863a
Parents: 4248d61
Author: Peter Kelly <pe...@uxproductivity.com>
Authored: Mon Aug 10 14:39:00 2015 +0700
Committer: Peter Kelly <pe...@uxproductivity.com>
Committed: Mon Aug 10 14:39:00 2015 +0700

----------------------------------------------------------------------
 CMakeLists.txt | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/4420811a/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f4218bb..d1f43c2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,6 +19,25 @@
 cmake_minimum_required(VERSION 3.1)
 project(Corinthia)
 
+message("Source directory is " ${CMAKE_SOURCE_DIR})
+message("Build directory is " ${CMAKE_BINARY_DIR})
+
+# Make sure we're not building in the root of the source tree
+if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+    message(FATAL_ERROR
+    "
+    Building in the source directory is not supported. Instead, you should
+    create another directory specifically for the build. For example:
+    
+    mkdir ~/build/corinthia
+    cd ~/build/corinthia
+    cmake -G \"${CMAKE_GENERATOR}\" ${CMAKE_SOURCE_DIR}
+    
+    Before this will work, you should delete CMakeCache.txt and
+    the CMakeFiles directory that were just generated in the source
+    directory.")
+endif()
+
 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)