aboutsummaryrefslogtreecommitdiff
path: root/cmake/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/compiler')
-rw-r--r--cmake/compiler/clang/settings.cmake2
-rw-r--r--cmake/compiler/msvc/settings.cmake25
2 files changed, 22 insertions, 5 deletions
diff --git a/cmake/compiler/clang/settings.cmake b/cmake/compiler/clang/settings.cmake
index 32ef8172534..4dad4cb7820 100644
--- a/cmake/compiler/clang/settings.cmake
+++ b/cmake/compiler/clang/settings.cmake
@@ -2,7 +2,7 @@
add_definitions(-D_BUILD_DIRECTIVE='"$(CONFIGURATION)"')
if(WITH_WARNINGS)
- set(WARNING_FLAGS "-W -Wall -Wextra -Winit-self -Wfatal-errors")
+ set(WARNING_FLAGS "-W -Wall -Wextra -Winit-self -Wfatal-errors -Wno-mismatched-tags")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS} -Woverloaded-virtual")
message(STATUS "Clang: All warnings enabled")
diff --git a/cmake/compiler/msvc/settings.cmake b/cmake/compiler/msvc/settings.cmake
index a455e97cc21..be8028da024 100644
--- a/cmake/compiler/msvc/settings.cmake
+++ b/cmake/compiler/msvc/settings.cmake
@@ -18,9 +18,11 @@ if(PLATFORM EQUAL 64)
add_definitions("-D_WIN64")
message(STATUS "MSVC: 64-bit platform, enforced -D_WIN64 parameter")
- #Enable extended object support for debug compiles on X64 (not required on X86)
- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj")
- message(STATUS "MSVC: Enabled extended object-support for debug-compiles")
+ if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.23026.0)
+ #Enable extended object support for debug compiles on X64 (not required on X86)
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj")
+ message(STATUS "MSVC: Enabled increased number of sections in object files")
+ endif()
else()
# mark 32 bit executables large address aware so they can use > 2GB address space
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
@@ -39,6 +41,17 @@ add_definitions(-D_BUILD_DIRECTIVE=\\"$(ConfigurationName)\\")
# multithreaded compiling on VS
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
+# /Zc:throwingNew.
+# When you specify Zc:throwingNew on the command line, it instructs the compiler to assume
+# that the program will eventually be linked with a conforming operator new implementation,
+# and can omit all of these extra null checks from your program.
+# http://blogs.msdn.com/b/vcblog/archive/2015/08/06/new-in-vs-2015-zc-throwingnew.aspx
+if(NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.23026.0))
+ # also enable /bigobj for ALL builds under visual studio 2015, increased number of templates in standard library
+ # makes this flag a requirement to build TC at all
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:throwingNew /bigobj")
+endif()
+
# Define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES - eliminates the warning by changing the strcpy call to strcpy_s, which prevents buffer overruns
add_definitions(-D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES)
message(STATUS "MSVC: Overloaded standard names")
@@ -51,6 +64,10 @@ message(STATUS "MSVC: Disabled NON-SECURE warnings")
add_definitions(-D_CRT_NONSTDC_NO_WARNINGS)
message(STATUS "MSVC: Disabled POSIX warnings")
+# Ignore specific warnings
+# C4351: new behavior: elements of array 'x' will be default initialized
+# C4091: 'typedef ': ignored on left of '' when no variable is declared
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4351 /wd4091")
if(NOT WITH_WARNINGS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267 /wd4619 /wd4512")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267 /wd4619 /wd4512")
@@ -61,7 +78,7 @@ endif()
# Fixes a compiler-problem when using PCH - the /Ym flag is adjusted by the compiler in MSVC2012, hence we need to set an upper limit with /Zm to avoid discrepancies)
# (And yes, this is a verified , unresolved bug with MSVC... *sigh*)
string(REGEX REPLACE "/Zm[0-9]+ *" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zm500" CACHE STRING "" FORCE)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zm500")
# Enable and treat as errors the following warnings to easily detect virtual function signature failures:
# 'function' : member function does not override any base class virtual member function