【问题标题】:Have Premake generate a vcxproj file that refers to an existing .props file让 Premake 生成一个引用现有 .props 文件的 vcxproj 文件
【发布时间】:2020-03-31 22:24:47
【问题描述】:

我正在使用提供 .props 文件的第三方 SDK,该文件用于 Visual Studio 项目。

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

如何告诉 Premake 生成 vcxproj 文件,使其添加对第三方 .props 文件的引用?

目前,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>

所以多了一个 Import 标签。

【问题讨论】:

    标签: visual-studio premake vcxproj


    【解决方案1】:

    没有内置的方式 afaik

    你可以考虑重写 propertySheets 函数

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

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

    【讨论】:

      猜你喜欢
      • 2012-12-01
      • 2019-03-31
      • 1970-01-01
      • 1970-01-01
      • 2013-01-21
      • 1970-01-01
      • 2016-01-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多