diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e211f2e25..e40bc5c1c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 \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()