inq*_*uam 13 msbuild c++builder
我正在尝试添加在编译期间由我的项目组使用的其他路径.由于C++ Builder 2010使用msbuild,我已经尝试查看文档,并根据我可以找到的内容,AdditionalLibPaths应该可以作为属性传递.即
msbuild /p:AdditionalLibPaths=C:\FooBar\Libs /t:build foo.groupproj
Run Code Online (Sandbox Code Playgroud)
但它似乎没有使用我添加的路径.我之前已经注意到,当传递给msbuild时,VC++和C++ Builder之间的某些属性名称有所不同,并且想知道C++ Builder是否可能使用其他属性名称来添加其他lib并包含文件夹?
我不想替换项目中定义的现有路径,而是添加其他路径.这样做的理由是,当项目在我们的构建服务器上构建时,一些库驻留在标准化的位置,这可能与它在开发机器上的安装位置不同.
的MSBuild实际上可以调用的MSBuild脚本文件,反过来调用其它脚本包括.groupproj使用的手机标签.我知道在使用时会创建一个新的msbuild实例 标记,所以我知道我必须在我的脚本中运行该任务时添加属性.
<MSBuild Targets="Build" Projects="..\Foo.groupproj" Properties="Config=Debug (property to add additional paths here!)" />
Run Code Online (Sandbox Code Playgroud)
更新:
C++ Builder似乎使用IncludePath和ILINK_LibraryPath,但设置这些会覆盖已在项目文件中定义的路径.由于此文件是由IDE创建和维护的,因此任何更改以使其附加而不是覆盖都将被IDE覆盖.这有点奇怪,因为它看起来确实应该附加值
<IncludePath>..\FooBar\;$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;Common Components;..\Config\Config32;$(IncludePath)</IncludePath>
Run Code Online (Sandbox Code Playgroud)
更新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>
Run Code Online (Sandbox Code Playgroud)
然后我可以打电话
msbuild /t:build /p:AdditionalIncludePaths=C:\Foo\Include foo.groupproj
Run Code Online (Sandbox Code Playgroud)
这工作正常,做我想要的.我只需要对库路径做同样的事情.但我不想破解Embarcaderos提供的这样的文件之一.这太荒谬了:P ...是否有任何官方属性可以设置添加包含路径和lib路径?
小智 11
对于VS2013,只需在运行msbuild之前定义环境变量:
set "INCLUDE=%additional_include_path%;%INCLUDE%"
set "LIB=%additional_lib_path%;%LIB%"
REM use environment variables for INCLUDE and LIB values
set UseEnv=true
Run Code Online (Sandbox Code Playgroud)
参考: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>
Run Code Online (Sandbox Code Playgroud)
但看起来像INCLUDE和LIB附加在项目属性中指定的其他include/lib目录后面.
有关includeVS2019 的附加信息,请使用开关/p:IncludePath=C:\Foo
要包含多个路径,请在开关上使用双引号和分号:
/p:IncludePath="C:\Foo;C:\Bar;C:\Another;$(IncludePath)"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16426 次 |
| 最近记录: |