我想在编译期间添加由我的项目组使用的其他路径。由于C++ Builder 2010使用msbuild我已经试过看那个文件,并根据我可以找到AdditionalLibPaths应该是可通过的属性。即从命令行编译时添加额外的库和包含路径
msbuild /p:AdditionalLibPaths=C:\FooBar\Libs /t:build foo.groupproj
但它似乎并没有使用我添加的路径。前面我已经注意到,一些属性名传递给的MSBuild和不知何时,如果C++ Builder中可能会使用一些其他的属性名称添加额外的lib和include文件夹之间VC++和C++ Builder的有什么不同?
我不想替换项目中定义的现有路径,但附加额外的路径。其基本原理是,当项目构建在我们的构建服务器上时,某些库驻留在一个标准化的位置,这个位置可能与开发机器上安装的位置不同。
的MSBuild实际上可以调用一个的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 ...是否有任何官方属性设置为添加包含路径和lib路径?
非常有用的答案,谢谢!关于这个环境变量,如果我们需要提供多个值路径,那么语法将如何? – 2017-05-08 13:54:29
@用分号NK-fford分开的多条路径 – Cozzamara 2017-05-11 05:49:34