CMake: Fix macro redefinition of Windows API versioning

This commit is contained in:
João Valverde 2021-09-20 18:54:54 +01:00
parent 76e31fe09e
commit 2c7d22dba2
2 changed files with 19 additions and 17 deletions

View File

@ -427,6 +427,25 @@ set_property(DIRECTORY
$<$<OR:$<BOOL:${DISABLE_DEBUG}>,$<CONFIG:Release>>:WS_DISABLE_DEBUG>
)
if(WIN32)
#
# Make sure everyone is using the same API and that it's sufficient
# for our needs.
# This should match the following:
# - The <compatibility><application> section in image\wireshark.exe.manifest.in
# - The GetWindowsVersion parts of packaging\nsis\wireshark.nsi
# - The VersionNT parts of packaging\wix\Prerequisites.wxi
#
# NOTE: Because of the way Qt moc is including "config.h" (not as the
# first header) this *MUST* be defined on the command line to precede
# every included header and not trigger symbol redefinition errors.
#
add_definitions(
-DNTDDI_VERSION=NTDDI_WIN7
-D_WIN32_WINNT=_WIN32_WINNT_WIN7
)
endif()
if( CMAKE_C_COMPILER_ID MATCHES "MSVC")
if ((MSVC_VERSION LESS "1900") OR (MSVC_VERSION GREATER_EQUAL "2000"))
message(FATAL_ERROR "You are using an unsupported version of MSVC")

View File

@ -289,23 +289,6 @@
#cmakedefine YYTEXT_POINTER
#if defined(_WIN32)
/*
* Make sure everyone is using the same API and that it's sufficient
* for our needs.
* This should match the following:
* - The <compatibility><application> section in image\wireshark.exe.manifest.in
* - The GetWindowsVersion parts of packaging\nsis\wireshark.nsi
* - The VersionNT parts of packaging\wix\Prerequisites.wxi
*/
# if defined(NTDDI_VERSION)
# error NTDDI_VERSION already defined.
# endif
# define NTDDI_VERSION NTDDI_WIN7
# if defined(_WIN32_WINNT)
# error _WIN32_WINNT already defined.
# endif
# define _WIN32_WINNT _WIN32_WINNT_WIN7
/* WpdPack/INclude/pcap/pcap.h checks for "#if defined(WIN32)" */
# ifndef WIN32
# define WIN32 1