mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Define WIN32_LEAN_AND_MEAN globally
In modern Windows code WIN32_LEAN_AND_MEAN should be defined. Without this define windows.h pulls in some legacy headers, notably winsocks.h. Modern code that cares about winsocks includes winsocks2.h which conflicts with winsocks.h. Other code that does not care about winsocks (OpenGL, fontconfig, ...) includes windows.h pulling in legacy winsocks.h, causing definition conflicts and build errors. At worst defining WIN32_LEAN_AND_MEAN requires explicitly including some additional headers on Windows.
This commit is contained in:
parent
ca54db2db4
commit
81bbb5e67b
@ -42,7 +42,6 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
// required for the windows gl.h to work
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
|
@ -62,6 +62,15 @@ set( CMAKE_MODULE_PATH "${KICAD_CMAKE_MODULE_PATH}" )
|
||||
|
||||
include( ConfigurePlatform )
|
||||
|
||||
if( WIN32 )
|
||||
# Without WIN32_LEAN_AND_MEAN defined including windows.h pulls in legacy
|
||||
# winsocks.h which conflicts with winsocks2.h used by modern libraries such
|
||||
# as curl.
|
||||
# There is no harm in defining this globally, at worst some additional
|
||||
# headers have to be included explicitly.
|
||||
add_compile_definitions( WIN32_LEAN_AND_MEAN )
|
||||
endif()
|
||||
|
||||
# Create a flag to identify the non-Apple unix systems
|
||||
if( UNIX AND NOT APPLE )
|
||||
set( UNIX_NOT_APPLE ON )
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#include <windows.h>
|
||||
#include <winspool.h>
|
||||
#elif defined( CUPS_LIST_PRINTERS )
|
||||
#include <cups/cups.h>
|
||||
#endif
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include <embedded_files.h>
|
||||
|
||||
#ifdef __WIN32__
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
|
@ -28,7 +28,6 @@
|
||||
|
||||
#if defined( _WIN32 )
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#include <windows.h>
|
||||
|
||||
int64_t GetRunningMicroSecs()
|
||||
|
Loading…
x
Reference in New Issue
Block a user