$NetBSD: patch-CMakeLists.txt,v 1.5 2024/02/11 14:48:14 ryoon Exp $ CMake 3.28.2 breaks unity build. From: https://projects.blender.org/blender/blender/commit/cf4365e555a759d5b3225bce77858374cb07faad Enable c++ extensions for alloca on NetBSD --- CMakeLists.txt.orig 2023-11-02 00:42:24.000000000 +0000 +++ CMakeLists.txt @@ -250,7 +250,7 @@ mark_as_advanced(CPACK_OVERRIDE_PACKAGEN mark_as_advanced(BUILDINFO_OVERRIDE_DATE) mark_as_advanced(BUILDINFO_OVERRIDE_TIME) -if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16") +if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16" AND NOT ${CMAKE_VERSION} VERSION_EQUAL "3.28.2") option(WITH_UNITY_BUILD "\ Enable unity build for modules that support it to improve compile times.\n\ WARNING: this option allows files to be built without all necessary headers!\n @@ -1221,6 +1221,7 @@ set(EXETYPE "") # C/C++ flags set(PLATFORM_CFLAGS) +set(PLATFORM_CXXFLAGS) # these are added to later on. set(C_WARNINGS) @@ -2022,7 +2023,8 @@ set(CMAKE_CXX_STANDARD 17) # If C++17 is not available, downgrading to an earlier standard is NOT OK. set(CMAKE_CXX_STANDARD_REQUIRED ON) # Do not enable compiler specific language extensions. -set(CMAKE_CXX_EXTENSIONS OFF) +# Sorry needed for alloca on NetBSD +set(CMAKE_CXX_EXTENSIONS ON) # Make MSVC properly report the value of the __cplusplus preprocessor macro # Available MSVC 15.7 (1914) and up, without this it reports 199711L regardless @@ -2093,7 +2095,7 @@ endif() # Include warnings first, so its possible to disable them with user defined flags # eg: -Wno-uninitialized set(CMAKE_C_FLAGS "${C_WARNINGS} ${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS}") -set(CMAKE_CXX_FLAGS "${CXX_WARNINGS} ${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS}") +set(CMAKE_CXX_FLAGS "${CXX_WARNINGS} ${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ${PLATFORM_CXXFLAGS}") # defined above, platform specific but shared names mark_as_advanced(