COMMON_LANGUAGE_RUNTIME and related settings are ignored with non-VS generators
If using this target property to set up CLR/CLI instead of manually specifying /clr
, only the Visual Studio generators actually set the necessary compiler flags. As it's just a compiler flag for cl.exe
which this property controls, rather than an MSBuild/Visual Studio-specific feature, it seems reasonable to set it with other generators when the compiler is MSVC, and spit out a warning/error with other compilers.
This could potentially be extended to more esoteric C++/CLI/.NET features, like VS_PACKAGE_REFERENCES
, as 'all' that needs to do is get command-line Nuget to fetch the relevant packages to an equivalent location and pass the necessary flags to the compiler and linker to use them, which is approximately one extra command and a couple of extra arguments in a makefile/Ninja build file. Obviously that's going to be a lot more work than just setting compiler flags, though.
If other tools start supporting C++/CLI in the future (e.g. if Microsoft fork Clang or GCC in their quest to increase .NET usage on Unix) it'll make it easier to get that working if there's already groundwork for relevant options not to be VS-specific, too.