Skip to content

Fix building with Visual Studio #27856

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Jojo-Schmitz
Copy link
Contributor

@Jojo-Schmitz Jojo-Schmitz commented Apr 26, 2025

Fixed this build error(s):
Screenshot 2025-04-25 183522

Similar to #21018

@@ -242,4 +242,8 @@ if (NOT MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VER
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-copy")
endif (NOT MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.0)

if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
add_compile_options("/bigobj")

or

Suggested change
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
target_compile_options(notation PRIVATE "/bigobj")

but then it needs to be after setup_module().

Or you could decide to make it global, and put the add_compile_options version in SetupBuildEnvironment. Perhaps that's best, but I'm not very sure. I don't know how big the downsides of this /bigobj option are. (If it's only that we can't use pre-2005 linkers with it, then we would surely be able to live with it, but it's unclear whether that's the whole story.)

By the way, I guess that the root cause is that the files become too large because of unity build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants