Skip to content
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

AdditionalCompilerOptions per file "/bigobj" #108

Closed
soufianekhiat opened this issue Jan 3, 2021 · 5 comments
Closed

AdditionalCompilerOptions per file "/bigobj" #108

soufianekhiat opened this issue Jan 3, 2021 · 5 comments

Comments

@soufianekhiat
Copy link

soufianekhiat commented Jan 3, 2021

How can I add a custom build option per file?
I am using AdditionalCompilerOptions for project, I would like to add "/bigobj" for a given cpp file.

@soufianekhiat
Copy link
Author

What I'm looking for is an equivalent from CMake;

if (MSVC)
  set_source_files_properties(Registry.cpp PROPERTIES COMPILE_FLAGS /bigobj)
endif()

Which commonly needed for generated code.

@belkiss
Copy link
Contributor

belkiss commented Mar 16, 2021

Unfortunately, Sharpmake doesn't really support per-file compiler options, only for some rare cases, and /bigobj is not one of those.

Any reason why you prefer not to set it globally? Afaik it doesn't have any negative impact.

@soufianekhiat
Copy link
Author

No real reason I used to do it in this way.
So an:
AdditionalCompilerOptions.Add("/bigobj");
Should work?

@belkiss
Copy link
Contributor

belkiss commented Mar 16, 2021

Correct, I usually recommend doing that in your configure method that's called on platforms using MSVC:

conf.AdditionalCompilerOptions.Add("/bigobj");

Note that you usually get faster compile times when you set options in the project rather than per file, that way visual studio (but really msbuild) can group the compiler invocations (ex: cl.exe /bigobj file1.cpp file2.cpp file3.cpp...), otherwise it will invoke it as many times as it needs to.

@soufianekhiat
Copy link
Author

I use to do it per file to keep track of the "too big file" if I can do something about it.
That will work for me.

[Fixed]

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

No branches or pull requests

2 participants