我正在尝试添加其他路径以供我的项目组在编译期间使用。由于C++ Builder 2010使用msbuild,我尝试查看文档,并根据我可以找到的内容,AdditionalLibPaths应该可以作为属性传递。IE
msbuild /p:AdditionalLibPaths=C:\FooBar\Libs /t:build foo.groupproj
但它似乎没有使用我添加的路径。我之前注意到VC++和C++ Builder之间的某些属性名称在传递给msbuild时会有所不同,并且想知道C++ Builder是否可能使用其他属性名称来添加额外的 lib 和包含文件夹?
我不想替换项目中定义的现有路径,而是附加其他路径。这样做的基本原理是,当项目在我们的构建服务器上构建时,一些库驻留在一个标准化的位置,可能与它在开发机器上的安装位置不同。
msbuild acutally 调用一个msbuild 脚本文件,该文件又调用其他脚本,包括.groupproj使用标签。我知道使用时会创建一个新的msbuild实例标记,所以我知道在我的脚本中运行该任务时我必须添加该属性。
<MSBuild Targets="Build" Projects="..\Foo.groupproj" Properties="Config=Debug (property to add additional paths here!)" />
更新:
C++ Builder似乎正在使用IncludePath和ILINK_LibraryPath但设置这些会覆盖项目文件中已定义的路径。由于此文件由 IDE 创建和维护,因此任何使其附加而不是覆盖的更改都将被 IDE 覆盖。这有点奇怪,因为它看起来确实应该附加值
<IncludePath>..\FooBar\;$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;Common Components;..\Config\Config32;$(IncludePath)</IncludePath>
更新 2:
在CodeGear.Cpp.Targets中,我将自己的名为AdditionalIncludePaths的属性添加到了PropertyGroup中,用于处理包含路径。
251号线附近
<PropertyGroup>
<BCC_NoLink>true</BCC_NoLink>
<ILINK_OSVersion Condition="'$(ILINK_OSVersion)'=='' And '$(NoVCL)'!='true'">5.0</ILINK_OSVersion>
<DCC_GenerateCppFiles>true</DCC_GenerateCppFiles>
<ShowStdOut Condition="'$(ShowStdOut)'==''">$(ShowGeneralMessages)</ShowStdOut>
<!-- _TCHAR mapping for Uni^H^H^H character selection -->
<StartupObj Condition="'$(_TCHARMapping)'=='wchar_t'">$(StartupObj)w</StartupObj>
<ILINK_StartupObjs Condition="'$(ILINK_StartupObjs)'==''">$(StartupObj)</ILINK_StartupObjs>
<BCC_GenerateUnicode Condition="'$(_TCHARMapping)'=='wchar_t'">true</BCC_GenerateUnicode>
<!-- Include Paths -->
<Win32LibraryPath Condition="'$(Win32LibraryPath)'==''">$(BDS)\lib</Win32LibraryPath>
<IncludePath Condition="'$(CBuilderIncludePath)'!=''">$(IncludePath);$(CBuilderIncludePath)</IncludePath>
<IncludePath Condition="'$(AdditionalIncludePath)'!=''">$(IncludePath);$(AdditionalIncludePath)</IncludePath>
<BCC_IncludePath Condition="'$(BCC_IncludePath)'!=''">$(BCC_IncludePath);$(IncludePath)</BCC_IncludePath>
<BCC_IncludePath Condition="'$(BCC_IncludePath)'==''">$(IncludePath)</BCC_IncludePath>
<BRCC_IncludePath Condition="'$(BRCC_IncludePath)'!=''">$(BRCC_IncludePath);$(IncludePath)</BRCC_IncludePath>
<BRCC_IncludePath Condition="'$(BRCC_IncludePath)'==''">$(IncludePath)</BRCC_IncludePath>
<DCC_IncludePath Condition="'$(DCC_IncludePath)'!=''">$(DCC_IncludePath);$(IncludePath)</DCC_IncludePath>
<DCC_IncludePath Condition="'$(DCC_IncludePath)'==''">$(IncludePath)</DCC_IncludePath>
<DCC_UnitSearchPath>$(DCC_IncludePath);$(Win32LibraryPath)</DCC_UnitSearchPath>
<DCC_ResourcePath>$(DCC_IncludePath)</DCC_ResourcePath>
<DCC_ObjPath>$(DCC_IncludePath)</DCC_ObjPath>
<TASM_IncludePath Condition="'$(TASM_IncludePath)'!=''">$(TASM_IncludePath);$(IncludePath)</TASM_IncludePath>
<TASM_IncludePath Condition="'$(TASM_IncludePath)'==''">$(IncludePath)</TASM_IncludePath>
然后我可以打电话
msbuild /t:build /p:AdditionalIncludePaths=C:\Foo\Include foo.groupproj
这工作正常,做我想要的。我只需要对库路径做同样的事情。但我不想像这样破解 Embarcaderos 提供的文件之一。这太荒谬了:P ...没有任何官方属性可以设置用于添加包含路径和库路径吗?