From f2454285fe29ab70147adc2136306fbe25b49d3e Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Thu, 20 Oct 2022 13:38:36 -0300 Subject: [PATCH] Set _WIN32_WINNT in static deps Set -D_WIN32_WINNT for static deps; unbound, in particular, needs this as the latest version appears to rely on something only provided in non-ancient windows to build properly. This required moving _winver into the toolchain file so that it is available earlier in cmake code (StaticBuild is included long before win32.cmake), but also this seems a more appropriate place for it. --- cmake/StaticBuild.cmake | 5 +++++ cmake/win32.cmake | 3 --- contrib/cross/mingw_core.cmake | 6 +++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cmake/StaticBuild.cmake b/cmake/StaticBuild.cmake index bfb346712..d0b9f7b29 100644 --- a/cmake/StaticBuild.cmake +++ b/cmake/StaticBuild.cmake @@ -167,6 +167,11 @@ if(APPLE) set(deps_CXXFLAGS "${deps_CXXFLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}") endif() +if(_winver) + set(deps_CFLAGS "${deps_CFLAGS} -D_WIN32_WINNT=${_winver}") + set(deps_CXXFLAGS "${deps_CXXFLAGS} -D_WIN32_WINNT=${_winver}") +endif() + if("${CMAKE_GENERATOR}" STREQUAL "Unix Makefiles") set(_make $(MAKE)) diff --git a/cmake/win32.cmake b/cmake/win32.cmake index ae3bdb6d2..a8f977c28 100644 --- a/cmake/win32.cmake +++ b/cmake/win32.cmake @@ -13,9 +13,6 @@ option(WITH_WINDOWS_32 "build 32 bit windows" OFF) # GNU ld sees fit to merge *all* the .ident sections in object files # to .r[o]data section one after the other! add_compile_options(-fno-ident -Wa,-mbig-obj) -# the minimum windows version, set to 6 rn because supporting older windows is hell -set(_winver 0x0600) -add_definitions(-D_WIN32_WINNT=${_winver}) if(EMBEDDED_CFG) link_libatomic() diff --git a/contrib/cross/mingw_core.cmake b/contrib/cross/mingw_core.cmake index a42673eda..8086ab7f3 100644 --- a/contrib/cross/mingw_core.cmake +++ b/contrib/cross/mingw_core.cmake @@ -1,4 +1,8 @@ -set(CMAKE_SYSTEM_VERSION 5.0) +set(CMAKE_SYSTEM_VERSION 6.0) + +# the minimum windows version, set to 6 rn because supporting older windows is hell +set(_winver 0x0600) +add_definitions(-D_WIN32_WINNT=${_winver}) # target environment on the build host system # second one is for non-root installs