From 9d0cb414652bbf1a39bdf911213772b00660a007 Mon Sep 17 00:00:00 2001 From: Phush Date: Tue, 24 Dec 2024 17:10:50 +1300 Subject: [PATCH] Apply /bigobj to fix debug builds on windows https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/fatal-error-c1128?view=msvc-170 --- CMakeLists.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b95e41..bbf6d50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,6 +47,23 @@ target_sources( cppfront/source/sema.h ) +# clang-cl: Clang on windows +if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")) + set(CLANG_CL 1) +endif() + +# Fix for debug builds on windows +# "fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj" +target_compile_options( + cppfront_cppfront PRIVATE + # Visual C++ for windows + $<$:/bigobj> + # GCC for windows + $<$:-Wa,-mbig-obj> + # Clang for windows + $<$:-bigobj> +) + ## # Target definition for cpp2util runtime library