让 Premake 生成一个引用现有 .props 文件的 vcxproj 文件

Have Premake generate a vcxproj file that refers to an existing .props file

我正在使用提供 .props 文件的第三方 SDK,该文件在 visual studio 项目中使用。

我使用 Premake 生成我的 .vcxproj 文件,而不是使用 SDK 的项目向导。

我如何告诉 Premake 以添加对第三方 .props 文件的引用的方式生成 vcxproj 文件?

目前,Premake 添加到我的 vcxproj 文件中:

  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>

然而,我希望它变成这样:

  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
    <Import Project="ACME_SDK.props" Condition="exists('ACME_SDK.props')" />
  </ImportGroup>

所以多了一个导入标签。

没有内置方式afaik

您可以考虑覆盖 propertySheets 函数

p.override(premake.vstudio.vc2010, 'propertySheets',  customPropertySheets)

其中 customPropertySheets 是您的函数,您需要在其中调用基本函数并添加您需要的任何其他内容。