1--- /dev/null	2020-11-18 16:00:00.000000000 -0500
2+++ cmake/os/MidnightBSD.cmake	2020-11-18 15:59:52.985914000 -0500
3@@ -0,0 +1,73 @@
4+# Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved.
5+#
6+# This program is free software; you can redistribute it and/or modify
7+# it under the terms of the GNU General Public License, version 2.0,
8+# as published by the Free Software Foundation.
9+#
10+# This program is also distributed with certain software (including
11+# but not limited to OpenSSL) that is licensed under separate terms,
12+# as designated in a particular file or component or in included license
13+# documentation.  The authors of MySQL hereby grant you an additional
14+# permission to link the program and your derivative works with the
15+# separately licensed software that they have included with MySQL.
16+#
17+# This program is distributed in the hope that it will be useful,
18+# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20+# GNU General Public License, version 2.0, for more details.
21+#
22+# You should have received a copy of the GNU General Public License
23+# along with this program; if not, write to the Free Software
24+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
25+
26+# This file includes BSD specific options and quirks,
27+# related to system checks
28+
29+INCLUDE(CheckCSourceRuns)
30+
31+
32+SET(MIDNIGHTBSD 1)
33+SET(FREEBSD 1)
34+
35+# On BSD some includes, e.g. sasl/sasl.h, is in /usr/local/include
36+LIST(APPEND CMAKE_REQUIRED_INCLUDES "/usr/local/include")
37+# Do not INCLUDE_DIRECTORIES here, we need to do that *after* configuring boost,
38+# in order to search include/boost_1_70_0/patches
39+# INCLUDE_DIRECTORIES(SYSTEM /usr/local/include)
40+
41+# We require at least Clang 6.0.
42+IF(NOT FORCE_UNSUPPORTED_COMPILER)
43+  IF(MY_COMPILER_IS_CLANG)
44+    CHECK_C_SOURCE_RUNS("
45+      int main()
46+      {
47+        return (__clang_major__ < 6);
48+      }" HAVE_SUPPORTED_CLANG_VERSION)
49+    IF(NOT HAVE_SUPPORTED_CLANG_VERSION)
50+      MESSAGE(FATAL_ERROR "Clang 6.0 or newer is required!")
51+    ENDIF()
52+  ELSEIF(MY_COMPILER_IS_GNU)
53+    EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -dumpversion
54+      OUTPUT_STRIP_TRAILING_WHITESPACE
55+      OUTPUT_VARIABLE GCC_VERSION)
56+    IF(GCC_VERSION VERSION_LESS 5.3)
57+      MESSAGE(FATAL_ERROR
58+        "GCC 5.3 or newer is required (-dumpversion says ${GCC_VERSION})")
59+    ENDIF()
60+    CHECK_C_SOURCE_RUNS("
61+      int main()
62+      {
63+        return (__clang_major__ >= 4);
64+      }" I386_ATOMIC_BUILTINS)
65+    IF((CMAKE_SYSTEM_PROCESSOR MATCHES "i386") AND (NOT I386_ATOMIC_BUILTINS))
66+      SET(HAVE_GCC_ATOMIC_BUILTINS CACHE  INTERNAL "")
67+    ENDIF()
68+  ELSEIF(CMAKE_COMPILER_IS_GNUCC)
69+    EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -dumpversion
70+                    OUTPUT_VARIABLE GCC_VERSION)
71+    IF(GCC_VERSION VERSION_LESS 4.4)
72+      MESSAGE(FATAL_ERROR "GCC 4.4 or newer is required!")
73+    ENDIF()
74+  ENDIF()
75+ENDIF()
76+
77