aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2020-01-31 13:10:51 +0100
committerAndreas Schneider <asn@samba.org>2020-01-31 13:18:02 +0100
commit73820709d152aff10d8fa0d858ff7070c873f272 (patch)
tree852c6f40ccb0b70cdbaf913d70712d36ea01445a
parent38e9c464879d2a451379c18b48c1fd993a8192e3 (diff)
downloadresolv_wrapper-73820709d152aff10d8fa0d858ff7070c873f272.tar.gz
resolv_wrapper-73820709d152aff10d8fa0d858ff7070c873f272.tar.xz
resolv_wrapper-73820709d152aff10d8fa0d858ff7070c873f272.zip
cmake: Update cmake defaults for out of source build
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
-rw-r--r--CMakeLists.txt4
-rw-r--r--cmake/Modules/DefineCMakeDefaults.cmake4
-rw-r--r--cmake/Modules/MacroEnsureOutOfSourceBuild.cmake17
3 files changed, 4 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 004372a..f569101 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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)
diff --git a/cmake/Modules/DefineCMakeDefaults.cmake b/cmake/Modules/DefineCMakeDefaults.cmake
index ef4fb33..9fb034f 100644
--- a/cmake/Modules/DefineCMakeDefaults.cmake
+++ b/cmake/Modules/DefineCMakeDefaults.cmake
@@ -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
index a2e9480..0000000
--- a/cmake/Modules/MacroEnsureOutOfSourceBuild.cmake
+++ /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)