msbuild /p:AdditionalLibPaths=C:\FooBar\Libs /t:build foo.groupproj
但似乎没有使用我添加的路径.我以前注意到,当传递给msbuild时,VC和C Builder之间的某些属性名有所不同,并且想知道C Builder是否可能使用其他属性名来添加额外的lib和包含文件夹?
我不想替换项目中定义的现有路径,但附加其他路径.这样做的理由是,当项目建立在我们的构建服务器上时,某些库位于标准化的位置,可能与开发机器上安装的位置不同.
msbuild acertally调用一个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路径?
解决方法
set "INCLUDE=%additional_include_path%;%INCLUDE%" set "LIB=%additional_lib_path%;%LIB%" REM use environment variables for INCLUDE and LIB values set UseEnv=true
参考:MSBuild / Microsoft.Cpp / v4.0 / V120 / Microsoft.Cpp.targets
<Target Name="SetBuildDefaultEnvironmentvariables"
Condition="'$(UseEnv)' != 'true'">
...
<SetEnv Name ="INCLUDE"
Value ="$(IncludePath)"
Prefix ="false" >
<Output TaskParameter="OutputEnvironmentvariable" PropertyName="INCLUDE"/>
</SetEnv>
但是看起来像INCLUDE和LIB附加在项目属性中指定的附加include / lib目录之后.