Skip to content

Commit

Permalink
Fix MSVC build errors from too many tests
Browse files Browse the repository at this point in the history
Compiling some test .cpp files with MSVC can fail with the following
error:

    C1128: number of sections exceeded object file format limit: compile with /bigobj

Enable the /bigobj flag to fix the build.

This commit should not change the behavior of tests aside from making
them compile.
  • Loading branch information
strager committed Feb 24, 2021
1 parent bfde3ff commit e131864
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmake/QuickLintJSCompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ function (quick_lint_js_enable_char8_t_if_supported)
endif ()
endfunction ()

function (quick_lint_js_enable_bigobj_if_supported TARGET)
check_cxx_compiler_flag(/bigobj QUICK_LINT_JS_HAVE_BIGOBJ)
if (QUICK_LINT_JS_HAVE_BIGOBJ)
target_compile_options("${TARGET}" PRIVATE $<$<COMPILE_LANGUAGE:CXX>:/bigobj>)
endif ()
endfunction ()

function (quick_lint_js_configure_exception_handling)
if (MSVC)
add_compile_options(/EHcs)
Expand Down
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ if (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.17.3)
<simdjson.h>
)
endif ()
quick_lint_js_enable_bigobj_if_supported(quick-lint-js-test)

add_test(
NAME quick-lint-js-test
Expand Down

0 comments on commit e131864

Please sign in to comment.