Skip to content
Snippets Groups Projects
Commit f5f3f775 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

Module cmake/modules/PreventInSourceBuilds.cmake copied from Frida.

This resolves #827.
parent 591d5d1e
No related branches found
No related tags found
No related merge requests found
......@@ -25,8 +25,9 @@ option(BORNAGAIN_CRASHHADLER "Additional machinery to send crash reports" OFF)
#--- Including macros ---
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
include(PreventInSourceBuilds)
include(BornAgainMacros)
#AssureOutOfSourceBuilds()
include(SearchInstalledSoftware)
include(CheckCompiler)
include(BornAgainConfiguration)
......
# This function will prevent in-source builds
function(AssureOutOfSourceBuilds)
# make sure the user doesn't play dirty with symlinks
get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH)
# disallow in-source builds
if("${srcdir}" STREQUAL "${bindir}")
message("###########################################################################")
message("We do not allow cmake to be run in the source directory.")
message("You must run cmake in a build directory.")
message("For example:")
message(" cd <source directory>")
message(" mkdir build")
message(" cd build")
message(" cmake .. # or ccmake, or cmake-gui")
message("")
message("To clean up after this aborted in-place compilation:")
message(" rm -r CMakeCache.txt CMakeFiles/")
message("###########################################################################")
message(FATAL_ERROR "Quitting configuration")
endif()
endfunction()
AssureOutOfSourceBuilds()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment