Fix some Windows issues

1. We need to set a Windows target to get rid of warnings when compiling
   files that include windows.h
2. By default Boost will try to automatically link against boost_system.
   In order to prevent this, we define BOOST_ALL_NO_LIB
3. Somehow, I had to include winioctl.h in Platform.cpp. According to
   the documentation from MS, this shouldn't be necessary as windows.h
   includes this as well. However, for me it didn't compile otherwise.
This commit is contained in:
mpilman 2019-03-07 08:20:50 -08:00 committed by Alex Miller
parent 36c12cd749
commit bc4820865e
2 changed files with 5 additions and 0 deletions

View File

@ -44,7 +44,11 @@ set(CMAKE_REQUIRED_LIBRARIES c)
if(WIN32)
# see: https://docs.microsoft.com/en-us/windows/desktop/WinProg/using-the-windows-headers
# this sets the windows target version to Windows 7
set(WINDOWS_TARGET 0x0601)
add_compile_options(/W3 /EHsc /std:c++14 /bigobj $<$<CONFIG:Release>:/Zi>)
add_compile_definitions(_WIN32_WINNT=${WINDOWS_TARGET} BOOST_ALL_NO_LIB)
else()
if(USE_GOLD_LINKER)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")

View File

@ -47,6 +47,7 @@
#include "flow/FaultInjection.h"
#ifdef _WIN32
#include <winioctl.h>
#define NOMINMAX
#include <windows.h>
#include <winioctl.h>