summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt18
1 files changed, 18 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a4135f4..e9f73ec 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,6 +10,24 @@ PROJECT (HDF5 C CXX)
# set CMAKE_INSTALL_PREFIX to the required install path.
# Make install can be used to install all components for system-wide use.
#
+if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
+ MESSAGE(FATAL_ERROR "\nERROR! ${PROJECT_NAME} DOES NOT SUPPORT IN SOURCE BUILDS!\n"
+ "CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}"
+ " == CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}\n"
+ "NEXT STEPS:\n"
+ "(1) Delete the CMakeCache.txt file and the CMakeFiles/ directory\n"
+ " under the source directory for ${PROJECT_NAME}, otherwise you\n"
+ " will not be able to configure ${PROJECT_NAME} correctly!\n"
+ " * For example, on linux machines do:\n"
+ " $ rm -r CMakeCache.txt CMakeFiles/\n"
+ "(2) Create a different directory and configure ${PROJECT_NAME} in that directory.\n"
+ " * For example, on linux machines do:\n"
+ " $ mkdir MY_BUILD\n"
+ " $ cd MY_BUILD\n"
+ " $ cmake [OPTIONS] ..\n"
+ )
+endif ()
+
#-----------------------------------------------------------------------------
# Instructions for use : Sub-Project Build
#