Understanding default Visual Studio compiler flags

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Understanding default Visual Studio compiler flags

Neal Kruis
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:


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?


Neal Kruis


Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe: