premake-core
premake-core copied to clipboard
[Visual Studio] Add /LTCG flag via premake
Discussed in https://github.com/premake/premake-core/discussions/1832
Originally posted by mrgoldengun March 4, 2022 Hello,
I have a question about flags { "LinkTimeOptimization" }
When I turned on this flag, the Visual Studio add /GL (Whole Program Optimization) and /LTCG:incremental (Link Time Code Generation). How can I config /GL and /LTCG (without incremental) via premake? AFAIK, It seems we don't have an option to do that in premake.
If I understand correctly, /LTCG is different from /LTCG:incremental
https://docs.microsoft.com/en-us/cpp/build/reference/ltcg-link-time-code-generation?view=msvc-170
a workaround is to remove that flags and add:
buildoptions { "/GL" }
linkoptions { "/LTCG" }