I am currently working on transforming our hard checked-in .csproj files into CMakeLists files. I ran into the problem that I do not know how to set the warning level in this case.
This is done in the .csproj file with the tag
but this does not affect the value in the configuration specific PropertyGroup which seems to override the value from non config specific PropertyGroup. Is there a way to solve this problem?
I am looking for a VS_GLOBAL_<CONFIG>_<variable> target property, to access the config specific section, but I do not think that exists.
Target-specific properties are usually derived from the flags for the target and/or the CMake target properties. If you replace /W1 with /W3 in the flags (or whatever the C# spelling for these flags happens to be), does that work?
Ok it was my mistake. Adding /warn:4 to the CMAKE_CSharp_FLAGS_DEBUG works.
I am not quite sure what went wrong because I tried setting the compiler flags. Must have made some trival mistake.
I think the behavior is different to what would be expected from a C++ target.
The following code will set warning level 1 to both targets/projects.
I think for C++ this would use differnet warning levels for both targets.