cmake: Update cmake defaults for out of source build
authorAndreas Schneider <asn@samba.org>
Fri, 31 Jan 2020 12:10:51 +0000 (13:10 +0100)
committerAndreas Schneider <asn@samba.org>
Fri, 31 Jan 2020 12:18:02 +0000 (13:18 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
CMakeLists.txt
cmake/Modules/DefineCMakeDefaults.cmake
cmake/Modules/MacroEnsureOutOfSourceBuild.cmake [deleted file]

index 004372a734b8d9a6053e3564c418e4f0427ecf77..f56910173be23a9406f9c1e755c51d1919efaf22 100644 (file)
@@ -38,10 +38,6 @@ include(DefineOptions.cmake)
 include(CPackConfig.cmake)
 include(CompilerChecks.cmake)
 
-# disallow in-source build
-include(MacroEnsureOutOfSourceBuild)
-macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out of source build. Please create a separate build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there.")
-
 # Find out if we have threading available
 set(CMAKE_THREAD_PREFER_PTHREADS ON)
 find_package(Threads)
index ef4fb3371b7534c4abc6030036b8cdcbc5e2ff70..9fb034f488e0c529fea80f2ddfdcba58f448adf1 100644 (file)
@@ -19,3 +19,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
 
 # Always build with -fPIC
 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+
+# Avoid source tree pollution
+set(CMAKE_DISABLE_SOURCE_CHANGES ON)
+set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
diff --git a/cmake/Modules/MacroEnsureOutOfSourceBuild.cmake b/cmake/Modules/MacroEnsureOutOfSourceBuild.cmake
deleted file mode 100644 (file)
index a2e9480..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-# - MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
-# MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
-
-# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-macro (MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage)
-
-   string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" _insource)
-   if (_insource)
-     message(SEND_ERROR "${_errorMessage}")
-     message(FATAL_ERROR "Remove the file CMakeCache.txt in ${CMAKE_SOURCE_DIR} first.")
-   endif (_insource)
-
-endmacro (MACRO_ENSURE_OUT_OF_SOURCE_BUILD)