From 3dda2ec590a305bea7023f98bb0c6da30c02c7d6 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 28 Dec 2017 02:02:23 +0300 Subject: [PATCH] Fix compiling on MSVC2017 --- cl_dll/CMakeLists.txt | 17 ++++++++++++++--- dlls/CMakeLists.txt | 11 +++++++++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/cl_dll/CMakeLists.txt b/cl_dll/CMakeLists.txt index 2d247950..824acc52 100644 --- a/cl_dll/CMakeLists.txt +++ b/cl_dll/CMakeLists.txt @@ -25,11 +25,22 @@ project (CLDLL) set (CLDLL_LIBRARY client) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-write-strings -DLINUX -D_LINUX -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL -w") + +add_definitions(-DCLIENT_WEAPONS -DCLIENT_DLL) + +if(NOT WIN32) + add_compile_options(-fno-exceptions) # GCC/Clang flag + add_compile_options(-Wno-write-strings) # GCC/Clang flag + add_definitions(-D_LINUX -DLINUX) # It seems enough for all non-Win32 systems + add_definitions(-Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf ) +else() + add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE) +endif() + if (GOLDSOURCE_SUPPORT) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGOLDSOURCE_SUPPORT") + add_definitions(-DGOLDSOURCE_SUPPORT) endif() -set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}") + set (CLDLL_SOURCES ../dlls/crossbow.cpp diff --git a/dlls/CMakeLists.txt b/dlls/CMakeLists.txt index 480b61d1..1564b90e 100644 --- a/dlls/CMakeLists.txt +++ b/dlls/CMakeLists.txt @@ -25,8 +25,15 @@ project (SVDLL) set (SVDLL_LIBRARY server) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_LINUX -DCLIENT_WEAPONS -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -fno-exceptions -w") -set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}") +add_definitions(-DCLIENT_WEAPONS) + +if(NOT WIN32) + add_compile_options(-fno-exceptions) # GCC/Clang flag + add_definitions(-D_LINUX) # It seems enough for all non-Win32 systems + add_definitions(-Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf ) +else() + add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE) +endif() set (SVDLL_SOURCES agrunt.cpp