diff --git a/CMakeLists.txt b/CMakeLists.txt index 44c0e2aba..2c10ed16b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/src/platform/C4WindowWin32.cpp b/src/platform/C4WindowWin32.cpp index 6a4e203fe..8e44f85d8 100644 --- a/src/platform/C4WindowWin32.cpp +++ b/src/platform/C4WindowWin32.cpp @@ -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)