Newer
Older
macro(INSANE_CHECK_OUT_OF_SOURCE_BUILD)
get_filename_component(bindir_parent ${CMAKE_BINARY_DIR} PATH)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
file(REMOVE_RECURSE ${CMAKE_SOURCE_DIR}/Testing)
file(REMOVE ${CMAKE_SOURCE_DIR}/DartConfiguration.tcl)
message(FATAL_ERROR "InSANE should be built as an out of source build, to keep the source directory clean. Please create a extra build directory and run the command 'cmake <path_to_source_dir>' in this newly created directory. You have also to delete the directory CMakeFiles and the file CMakeCache.txt in the source directory. Otherwise cmake will complain even if you run it from an out-of-source directory.")
elseif(IS_SYMLINK ${CMAKE_BINARY_DIR} AND CMAKE_SOURCE_DIR STREQUAL bindir_parent)
message(FATAL_ERROR "InSANE cannot be built from a sub-directory of the source tree that is a symlink. This is a current limitation of CMake. Please create a real build directory and run the command 'cmake <path_to_source_dir>' in this newly created directory.")
endif()
endmacro()