From: =?utf-8?q?Sandro_Knau=C3=9F?= <hefee@debian.org>
Date: Mon, 19 Apr 2021 18:54:56 +0200
Subject: Don't modify build flags within the package

Origin: debian
Last-Update: 2015-10-24

For being able to have full control over the build process, we need
full control over the build flags set. That's why it is recommended to disable
any modification from these flags from package side.
Last-Update: 2015-10-24
---
 cmake/modules/DefineCMakeDefaults.cmake    | 29 +++++++++++++++++++++++++++
 cmake/modules/DefinePlatformDefaults.cmake | 32 ++++++++++++++++++++++++++++++
 src/csync/CMakeLists.txt                   |  3 +++
 src/csync/DefineOptions.cmake              |  1 +
 4 files changed, 65 insertions(+)
 create mode 100644 cmake/modules/DefineCMakeDefaults.cmake
 create mode 100644 cmake/modules/DefinePlatformDefaults.cmake
 create mode 100644 src/csync/DefineOptions.cmake

diff --git a/cmake/modules/DefineCMakeDefaults.cmake b/cmake/modules/DefineCMakeDefaults.cmake
new file mode 100644
index 0000000..8c00f49
--- /dev/null
+++ b/cmake/modules/DefineCMakeDefaults.cmake
@@ -0,0 +1,29 @@
+# (c) 2014 Copyright ownCloud GmbH
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING* file.
+
+# Always include srcdir and builddir in include path
+# This saves typing ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY} in
+# about every subdir
+# since cmake 2.4.0
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+# Put the include dirs which are in the source or build tree
+# before all other include dirs, so the headers in the sources
+# are preferred over the already installed ones
+# since cmake 2.4.1
+set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
+
+# Use colored output
+# since cmake 2.4.0
+set(CMAKE_COLOR_MAKEFILE ON)
+
+# Define the generic version of the libraries here
+set(GENERIC_LIB_VERSION "0.1.0")
+set(GENERIC_LIB_SOVERSION "0")
+
+# set -Werror
+set(CMAKE_ENABLE_WERROR ON)
+
+# enables folders for targets to be visible in an IDE
+set_property(GLOBAL PROPERTY USE_FOLDERS ON)
diff --git a/cmake/modules/DefinePlatformDefaults.cmake b/cmake/modules/DefinePlatformDefaults.cmake
new file mode 100644
index 0000000..91f6592
--- /dev/null
+++ b/cmake/modules/DefinePlatformDefaults.cmake
@@ -0,0 +1,32 @@
+# (c) 2014 Copyright ownCloud GmbH
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING* file.
+
+# Set system vars
+
+if (CMAKE_SYSTEM_NAME MATCHES "Linux")
+    set(LINUX TRUE)
+endif(CMAKE_SYSTEM_NAME MATCHES "Linux")
+
+if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+    set(FREEBSD TRUE)
+    set(BSD TRUE)
+endif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+
+if (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
+    set(OPENBSD TRUE)
+    set(BSD TRUE)
+endif (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
+
+if (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+    set(NETBSD TRUE)
+    set(BSD TRUE)
+endif (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+
+if (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
+    set(SOLARIS TRUE)
+endif (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
+
+if (CMAKE_SYSTEM_NAME MATCHES "OS2")
+    set(OS2 TRUE)
+endif (CMAKE_SYSTEM_NAME MATCHES "OS2")
diff --git a/src/csync/CMakeLists.txt b/src/csync/CMakeLists.txt
index 11c1e1a..d5ad935 100644
--- a/src/csync/CMakeLists.txt
+++ b/src/csync/CMakeLists.txt
@@ -11,6 +11,9 @@ set(LIBRARY_SOVERSION "0")
 
 # add definitions
 option(MEM_NULL_TESTS "Enable NULL memory testing" OFF)
+include(DefineCMakeDefaults)
+include(DefinePlatformDefaults)
+include(DefineOptions.cmake)
 
 
 include(ConfigureChecks.cmake)
diff --git a/src/csync/DefineOptions.cmake b/src/csync/DefineOptions.cmake
new file mode 100644
index 0000000..5cb525f
--- /dev/null
+++ b/src/csync/DefineOptions.cmake
@@ -0,0 +1 @@
+option(MEM_NULL_TESTS "Enable NULL memory testing" OFF)
