I would like to use the new (and better) diagnostic information from visual studio 2017.
To have it enabled to all my project at once I want to declare this flag from my CMakeLists.txt
I tried
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /diagnostics:caret")
But when compiling there is an error saying that /diagnostics:classic (which is the default value) is not compatible with /diagnostics:caret
Is there a way to override the default value using cmake ?
You just have to know that VS compiler options that CMake does not yet officially support will end up under:
Properties
/C/C++
/Command Line
/Additional Options
That's why you get
But you can give
cl
options globally with the newVS_USER_PROPS
target property (version >= 3.8).Here is a working example:
CMakeLists.txt
Reference