aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Schultz <karl@lunarg.com>2018-01-04 11:16:06 -0700
committerKarl Schultz <karl@lunarg.com>2018-01-04 15:08:26 -0700
commit90732cebb37d1524e90026235da2b1f72076acee (patch)
treef1fe00c4e03adaaa2bf5cd4e6eb841d7addf5dff
parent19dedae9512694e239c7f1c577353c175511a876 (diff)
downloadusermoji-90732cebb37d1524e90026235da2b1f72076acee.tar.xz
build: Fix application of /bigobj compile flag
Fixes #2316 Affects only Windows builds. Need to compile code that generates large object files with the /bigobj option in order to avoid exceeding the default number of sections in an object file. This change applies the /bigobj compiler option to all configurations, rather than just Debug. It also applies it only to selected files, instead of all the files in the project. Although /bigobj is now applied to Release builds, this does not increase build time.
-rw-r--r--layers/CMakeLists.txt11
1 files changed, 5 insertions, 6 deletions
diff --git a/layers/CMakeLists.txt b/layers/CMakeLists.txt
index 218df5cb..53beccbf 100644
--- a/layers/CMakeLists.txt
+++ b/layers/CMakeLists.txt
@@ -174,12 +174,11 @@ include_directories(
)
if (WIN32)
- 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")
- set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -D_CRT_SECURE_NO_WARNINGS")
- set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -D_CRT_SECURE_NO_WARNINGS")
- 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")
+ # Applies to all configurations
+ add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+ # Avoid: fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj
+ set_source_files_properties(core_validation.cpp threading.cpp
+ PROPERTIES COMPILE_FLAGS "/bigobj")
# Turn off transitional "changed behavior" warning message for Visual Studio versions prior to 2015.
# The changed behavior is that constructor initializers are now fixed to clear the struct members.
add_compile_options("$<$<AND:$<CXX_COMPILER_ID:MSVC>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,19>>:/wd4351>")