i got stuck with a problem which has to do with a managed c++ Project.
Currently we have a working Build and we are about to use CMake to generate our Solution Files in the future.
In our solution we have some Managed C++ Project and C# Projects. I tried to generate/build the Managed C++ Projects and it works. But there is one key thing that is different which atually breaks the build.
In our working build the managed C++ Project has the Xml Tag <TargetFrameworkVersion>
but when I use CMake to configure/generate the Project I end up having <TargetFramework>
and this breaks the build ( I confirmed by manually changing the Tag).
I got stuck with this Problem for 2 days and the following things I already tried:
- I tried setting VS_DOTNET_TARGET_FRAMEWORK_VERSION which actually is deprecated but makes sense because of the name. I ended up having in the Project file.
- I also tried the newer Variables DOTNET_TARGET_FRAMEWORK, DOTNET_TARGET_FRAMEWORK_VERSION but I ended up again with in the Project file.
- I thought to myself I could change the Project file after I configure/generate but thats pretty hacky (but works)
There is a second solution which actually works but is not what I really want. I can tell cmake.exe to pass some options to the native MsBuild tool to build the managed C++ target. This works but I would prefer to some how tell the CMakeLists.txt to do this or even better have the right Xml tag when generating the Proect files because we don't want to use the command line when building our projects.
The approach looks like this (Target Name is NotifierLib and .NET Framework Version is 4.7.2)
cmake --build . --target NotifierLib -- /p:TargetFrameworkVersion=v4.7.2
Did anyone came across this exact issue? Or maybe has an idea how to solve this via CMakeLists.txt?
Thanks in advance.