Win32: Fix build with MSVC's Clang-based toolset

Well, somewhat. I can't get Clang/C2 to build Qt so I can't build OC
with Qt support.
alut-include-path
Nicolas Hake 2017-01-07 13:29:49 +01:00
parent c2ae62975a
commit 561e083181
2 changed files with 12 additions and 7 deletions

View File

@ -124,8 +124,16 @@ if(USE_GCC_STYLE_LTCG)
endif()
if(MSVC)
# Disable non-standard conversion from string literal to (nonconst) char*
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:strictStrings")
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
# Set up some additional flags only if we're using the MS compiler,
# and not the clang-based toolchain
# Disable non-standard conversion from string literal to (nonconst) char*
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:strictStrings")
# Activate edit-and-continue
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /ZI /Gy")
endif()
# Enable multi-core builds
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
@ -135,9 +143,6 @@ if(MSVC)
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /Ob2 /GL")
add_linker_flags(optimized MODULES exe shared static FLAGS "/LTCG:incremental")
# Activate edit-and-continue
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /ZI /Gy")
# do not link the release CRT in debug builds
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:MSVCRT")
set(HAVE_PRECOMPILED_HEADERS ON CACHE INTERNAL "Compiler supports precompiled headers")
@ -1301,7 +1306,7 @@ endif()
# Precompiled header support for MSVC
############################################################################
if(HAVE_PRECOMPILED_HEADERS)
if(MSVC)
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
get_property(OC_SOURCES TARGET openclonk PROPERTY SOURCES)
foreach(FILE ${OC_SOURCES})
get_filename_component(FILE_EXT ${FILE} EXT)

View File

@ -1010,7 +1010,7 @@ bool C4AbstractApp::SetVideoMode(int iXRes, int iYRes, unsigned int iRefreshRate
dspMode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
if (iRefreshRate != 0)
dspMode.dmFields |= DM_DISPLAYFREQUENCY;
DWORD rv = ChangeDisplaySettingsExW(iMonitor ? Mon.GetWideChar() : nullptr, &dspMode, nullptr, CDS_FULLSCREEN, nullptr);
LONG rv = ChangeDisplaySettingsExW(iMonitor ? Mon.GetWideChar() : nullptr, &dspMode, nullptr, CDS_FULLSCREEN, nullptr);
if (rv != DISP_CHANGE_SUCCESSFUL)
{
switch (rv)