CMake 的 VS

编程入门 行业动态 更新时间:2024-10-25 20:21:34
本文介绍了CMake 的 VS_PACKAGE_REFERENCES 未添加对 VS2017 项目的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试使用 CMake 自动向我的 (C++) Visual Studio 2017 项目添加 (nuget) 引用.

I'm trying to automatically add (nuget) references to my (C++) visual studio 2017 project using CMake.

在 this 问题中,建议使用 VS_PACKAGE_REFERENCES,可从CMAKE 3.15.所以,我在我的 CMAKE 代码中添加了以下内容:

In this question, VS_PACKAGE_REFERENCES is suggested, available from CMAKE 3.15. So, I've added the following to my CMAKE code:

set_property(TARGET MyApplication PROPERTY VS_PACKAGE_REFERENCES "BaseUtils.Native.Dynamic_0.4.0.38060" )

以下内容很好地添加到了我的项目中:

And the following is nicely added to my project:

<ItemGroup> <PackageReference Include="BaseUtils.Native.Dynamic" Version="0.4.0.38060" /> </ItemGroup>

但是,解决方案资源管理器中不显示引用,也没有将任何包含文件夹添加到项目中.似乎没有考虑 PackageReference 元素.

However, the reference is not show in the solution explorer, nor are any include folders added to the project. It seems that the PackageReference element is in no way taken into account.

有人知道如何解决这个问题吗?我正在使用 CMake 3.15.3,它不会给出任何错误或警告.

Anyone any idea how to solve this? I'm using CMake 3.15.3, which doesn't give any errors or warnings.

推荐答案

嗯,根据 docs.microsoft

面向完整 .NET Framework 的 ASP.NET 应用程序仅包括有限的支持 PackageReference.C++ 和 JavaScript 项目类型是不受支持.

ASP.NET apps targeting the full .NET Framework include only limited support for PackageReference. C++ and JavaScript project types are unsupported.

这使得 CMake 中的整个 VS_PACKAGE_REFERENCES 选项不适用于 C++ 项目.

This makes the whole VS_PACKAGE_REFERENCES option from CMake inapplicable for C++ projects.

更多推荐

CMake 的 VS

本文发布于:2023-11-16 22:18:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1607694.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:CMake

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!