[CMake] Understanding default Visual Studio compiler flags
Neal Kruis
neal.kruis at bigladdersoftware.com
Tue Dec 5 17:36:11 EST 2017
Hi all,
I'm hoping someone can clarify some confusion I have regarding the flags
used in Visual Studio Cmake builds.
For example, in a release build, there are the defaults:
CMAKE_CXX_FLAGS:STRING=/DWIN32 /D_WINDOWS /W3 /GR /EHsc
CMAKE_CXX_FLAGS_RELEASE:STRING=/MD /O2 /Ob2 /DNDEBUG
We can obviously append to or modify these within our CMakeLists.txt files.
However, my actual build flags look like this:
/nologo /W3 /WX- /O2 /Ob2 /Oy- /D WIN32 /D _WINDOWS /D NDEBUG /D
"CMAKE_INTDIR=\"Release\"" /D _MBCS /Gm- /EHsc /MT /GS /fp:precise
/Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"PROJECT.DIR\RELEASE\\"
/Fd"PROJECT.DIR\RELEASE\VC140.PDB" /Gd /TP /analyze-
Where are all these other flags coming from? Some of these I appreciate are
necessary for the CMake mechanics to work, but what if (for whatever
reason) I wanted to remove one of the other flags that isn't defined by
CMAKE_CXX_FLAGS or CMAKE_CXX_FLAGS_RELEASE (e.g., /Zc:wchar_t)?
Can Cmake users override the values from the default flag table
<https://gitlab.kitware.com/cmake/cmake/blob/master/Source/cmVS141CLFlagTable.h>
?
Regards,
Neal Kruis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20171205/7f869535/attachment.html>
More information about the CMake
mailing list