Skip to content

Commit

Permalink
Fix downversioning of _WIN32_WINNT
Browse files Browse the repository at this point in the history
Forcing the _WIN32_WINNT when the environment is already forcing a value
results in a lot of warning.

If the user compiles for a higher version of Windows, we don't need to force
compilation for Vista.
  • Loading branch information
robUx4 committed Jun 19, 2023
1 parent ec52c45 commit dfb703b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,11 @@ if(WIN32)
if(ENABLE_INET_PTON)
set(CMAKE_REQUIRED_LIBRARIES ws2_32)
check_function_exists(inet_pton HAVE_INET_PTON)
add_definitions(-D_WIN32_WINNT=0x0600)
check_c_source_compiles("#include <windows.h>\n#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600\n#error NOPE\n#endif\nint main(void) {return 0;}" AT_LEAST_VISTA)
if(NOT AT_LEAST_VISTA)
# force targeting Vista
add_definitions(-D_WIN32_WINNT=0x0600)
endif()
else()
add_definitions(-D_WIN32_WINNT=0x0501)
endif()
Expand Down

0 comments on commit dfb703b

Please sign in to comment.