$OpenBSD: patch-cmake_BuildType_cmake,v 1.1 2020/12/15 19:38:22 cwen Exp $

Fix the build on powerpc.
Should be reviewed once lld becomes the default linker on powerpc

Index: cmake/BuildType.cmake
--- cmake/BuildType.cmake.orig
+++ cmake/BuildType.cmake
@@ -301,6 +301,15 @@ else(MSVC)
 		if(MACOS)
 			# TODO For some reason this check succeeds on macOS, but then
 			# flag causes the actual build to fail :(
+		elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD"
+		       AND CMAKE_SYSTEM_PROCESSOR STREQUAL "powerpc")
+			# XXX Need a review once lld is the default linker on powerpc
+			# -Wl,--as-needed causes the std::unique_ptr test to
+			# fail due to undefined reference errors, and user
+			# supplied linker flags are removed during the test. A
+			# fallback exists, using std::auto_ptr, but it has been
+			# disabled by C++17. Use the same code as other archs
+			# instead of reenabling std::auto_ptr.
 		else()
 			# Link as few libraries as possible
 			# This is much easier than trying to decide which libraries are needed for each
