diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index 075caef8d1..150cb7b388 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -172,6 +172,7 @@ resourcestring 'info file after build. If not specified, build number will be incremented '+ 'if configured.'; + lisExtraOpts = 'Pass additional options to the compiler'; lisGetExpandText = 'Print the result of substituting macros in the text. '+ 'The absence of macros in the text means the name of the macro. '+ 'By default, active build mode is used.'; diff --git a/ide/lazbuild.lpr b/ide/lazbuild.lpr index 4e621e7ca6..bb201e92af 100644 --- a/ide/lazbuild.lpr +++ b/ide/lazbuild.lpr @@ -471,6 +471,7 @@ function TLazBuildApplication.BuildPackage(const AFilename: string): boolean; var APackage: TLazPackage; Flags: TPkgCompileFlags; + S: String; begin Result:=false; @@ -498,6 +499,9 @@ begin APackage.CompilerOptions.TargetCPU:=CPUOverride; if SubtargetOverride then APackage.CompilerOptions.Subtarget:=SubtargetOverrideValue; + if HasLongOptIgnoreCase('opt', S) then + with APackage.CompilerOptions do + CustomOptions := MergeCustomOptions(CustomOptions, S); if CreateMakefile then DoCreateMakefile(APackage) @@ -807,6 +811,10 @@ var MatrixOption.MacroName:='LCLWidgetType'; MatrixOption.Value:=WidgetSetOverride; end; + if HasLongOptIgnoreCase('opt', S) then + with Project1.CompilerOptions do + CustomOptions := MergeCustomOptions(CustomOptions, S); + // apply options MainBuildBoss.SetBuildTargetProject1(true,smsfsSkip); @@ -1583,6 +1591,7 @@ begin LongOptions.Add('subtarget:'); LongOptions.Add('bm:'); LongOptions.Add('build-mode:'); + LongOptions.Add('opt:'); LongOptions.Add('compiler:'); LongOptions.Add('lazarusdir:'); LongOptions.Add('create-makefile'); @@ -1820,6 +1829,9 @@ begin writeln('--bm=, --build-mode='); w(lisOverrideTheProjectBuildMode); writeln(''); + writeln('--opt='); + w(lisExtraOpts); + writeln(''); writeln('--compiler='); w(lisOverrideTheDefaultCompilerEGPpc386Ppcx64PpcppcEtcD); writeln('');