pavelliavonau/cmakeconverter

Nuget packages fails with no implementation of use_packages

EdTheC opened this issue · 1 comments

All I can find on this is the one line in the docs: "Also cmake converter tries to read info about used NuGet packages and makes stubs for using it with use_package function."
And could not find anything in forum, so here goes:

Describe the bug
I have a solution with Nuget Packages. When I run the converter, I see an error like:
file or path "c:\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.8.0\build\native\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.targets" not found.
0.503652
1> ERR : c:\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.8.0\build\native\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.targets file not exists.

Then the cmake produces an error:
1> [CMake] No implementation of use_package. Create yours. Package
1> [CMake] "cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn"
1> [CMake] with version "2.8.0" for target "ImageProcDLL" is ignored!
1> [CMake] Call Stack (most recent call first):
1> [CMake] CMakeLists.txt:566 (use_package)

So I think the very first problem is that the converter is looking in c:\packages, but that's not where they are. ../packages Is where they are, and that is what is in the vcxproj, like this:
<ImportGroup Label="ExtensionTargets"> <Import Project="../packages/cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.8.0/build/native/cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.targets" Condition="Exists(''../packages/cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.8.0/build/native/cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.targets')" />
etc.

So for a test, I put the complete path to the package in the vcxproj file. The cmake-convert did not show any packages errors.

However, the same use_package error occurs in the cmake part.

I do think that there is a bug in that ../packages becomes c:/packages during conversion. But I need to know how to get past the use_packages error.

Can you please guide me on this? A workaround would be fine.
TIA

I would say: DO NOT USE NUGET WITH CMAKE. Because there is no integration.

But. Before creating issue did you try edit and get working example of your case?? You should do that and understand how difficult to translate .targets into cmake language.

We did NUGET - cmake integration manually with use_package function. It's fragile and tricky. You should decide yourself what and how to do at this case.