From 0ff2a1c236fe6633a2dca1fc3cc2ea65952edf75 Mon Sep 17 00:00:00 2001 From: Mark Young Date: Mon, 18 Jan 2016 17:22:48 -0700 Subject: BUILD: Fix build of draw_state.cpp with VS 2015. Added /bigobj to Debug build of all layer files when using VS 2015 or newer. --- layers/CMakeLists.txt | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'layers') diff --git a/layers/CMakeLists.txt b/layers/CMakeLists.txt index b5933578..44345d62 100644 --- a/layers/CMakeLists.txt +++ b/layers/CMakeLists.txt @@ -88,8 +88,21 @@ include_directories( ) if (WIN32) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS") + set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D_CRT_SECURE_NO_WARNINGS") + set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -D_CRT_SECURE_NO_WARNINGS") + + # For VS 2015, which uses compiler version 1900, draw_state.cpp fails with too many objects + # without either optimizations enabled, or setting the /bigobj compilation option. Since + # optimizations are enabled in a release build, this only affects the debug build. For now, + # enable /bigobj mode for all debug layer files. An alternative for the future is to split + # draw_state.cpp into multiple files, which will also alleviate the compilation error. + if (NOT (MSVC_VERSION LESS 1900)) + set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_CRT_SECURE_NO_WARNINGS /bigobj") + set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_CRT_SECURE_NO_WARNINGS /bigobj") + else() + set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_CRT_SECURE_NO_WARNINGS") + set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_CRT_SECURE_NO_WARNINGS") + endif() endif() if (NOT WIN32) set (CMAKE_CXX_FLAGS "-std=c++11") -- cgit v1.2.3