Skip to content

Commit

Permalink
Set _WIN32_WINNT in static deps
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jagerman committed Oct 20, 2022
1 parent 081dfd3 commit f245428
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions cmake/StaticBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
3 changes: 0 additions & 3 deletions cmake/win32.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 5 additions & 1 deletion contrib/cross/mingw_core.cmake
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit f245428

Please sign in to comment.