mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-21 13:59:10 +02:00
fixed targetfilename calculation
git-svn-id: trunk@4940 -
This commit is contained in:
parent
7a4bc76f30
commit
8be99ebec5
@ -316,6 +316,7 @@ type
|
|||||||
function GetIncludePath(RelativeToBaseDir: boolean): string;
|
function GetIncludePath(RelativeToBaseDir: boolean): string;
|
||||||
function GetSrcPath(RelativeToBaseDir: boolean): string;
|
function GetSrcPath(RelativeToBaseDir: boolean): string;
|
||||||
function GetLibraryPath(RelativeToBaseDir: boolean): string;
|
function GetLibraryPath(RelativeToBaseDir: boolean): string;
|
||||||
|
function GetUnitOutPath(RelativeToBaseDir: boolean): string;
|
||||||
function GetParsedPath(Option: TParsedCompilerOptString;
|
function GetParsedPath(Option: TParsedCompilerOptString;
|
||||||
InheritedOption: TInheritedCompilerOption;
|
InheritedOption: TInheritedCompilerOption;
|
||||||
RelativeToBaseDir: boolean): string;
|
RelativeToBaseDir: boolean): string;
|
||||||
@ -1442,8 +1443,8 @@ function TBaseCompilerOptions.CreateTargetFilename(
|
|||||||
var
|
var
|
||||||
Ext: String;
|
Ext: String;
|
||||||
begin
|
begin
|
||||||
if ExtractFileExt(fTargetOS)<>'' then exit;
|
if (ExtractFileName(Result)='') or (ExtractFileExt(Result)<>'') then exit;
|
||||||
if CompareText(fTargetOS, 'win32') = 0 then begin
|
if AnsiCompareText(fTargetOS, 'win32') = 0 then begin
|
||||||
Result:=Result+'.exe';
|
Result:=Result+'.exe';
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
@ -1454,19 +1455,24 @@ function TBaseCompilerOptions.CreateTargetFilename(
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
UnitOutDir: String;
|
||||||
|
OutFilename: String;
|
||||||
begin
|
begin
|
||||||
if (TargetFilename <> '') then begin
|
// first case: fully specific target filename
|
||||||
Result:=ExtractFilePath(MainSourceFileName)+TargetFilename;
|
if (TargetFilename <> '') and FilenameIsAbsolute(TargetFilename) then begin
|
||||||
AppendDefaultExt;
|
Result:=TargetFilename;
|
||||||
end else begin
|
end else begin
|
||||||
|
// calculate output directory
|
||||||
|
UnitOutDir:=GetUnitOutPath(false);
|
||||||
|
if UnitOutDir='' then
|
||||||
|
UnitOutDir:=ExtractFilePath(MainSourceFileName);
|
||||||
// fpc creates lowercase executables as default
|
// fpc creates lowercase executables as default
|
||||||
Result:=lowercase(ExtractFileNameOnly(MainSourceFileName));
|
OutFilename:=lowercase(ExtractFileNameOnly(MainSourceFileName));
|
||||||
if Result<>'' then begin
|
Result:=AppendPathDelim(UnitOutDir)+OutFilename;
|
||||||
Result:=ExtractFilePath(MainSourceFileName)+Result;
|
|
||||||
AppendDefaultExt;
|
|
||||||
end else
|
|
||||||
Result:='';
|
|
||||||
end;
|
end;
|
||||||
|
Result:=TrimFilename(Result);
|
||||||
|
AppendDefaultExt;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBaseCompilerOptions.GetInheritedCompilerOptions(
|
procedure TBaseCompilerOptions.GetInheritedCompilerOptions(
|
||||||
@ -1545,6 +1551,14 @@ begin
|
|||||||
Result:=GetParsedPath(pcosLibraryPath,icoLibraryPath,RelativeToBaseDir);
|
Result:=GetParsedPath(pcosLibraryPath,icoLibraryPath,RelativeToBaseDir);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TBaseCompilerOptions.GetUnitOutPath(RelativeToBaseDir: boolean
|
||||||
|
): string;
|
||||||
|
begin
|
||||||
|
Result:=ParsedOpts.GetParsedValue(pcosOutputDir);
|
||||||
|
if (not RelativeToBaseDir) then
|
||||||
|
CreateAbsolutePath(Result,BaseDirectory);
|
||||||
|
end;
|
||||||
|
|
||||||
function TBaseCompilerOptions.GetParsedPath(Option: TParsedCompilerOptString;
|
function TBaseCompilerOptions.GetParsedPath(Option: TParsedCompilerOptString;
|
||||||
InheritedOption: TInheritedCompilerOption;
|
InheritedOption: TInheritedCompilerOption;
|
||||||
RelativeToBaseDir: boolean): string;
|
RelativeToBaseDir: boolean): string;
|
||||||
|
Loading…
Reference in New Issue
Block a user