diff --git a/components/lazutils/lazfileutils.inc b/components/lazutils/lazfileutils.inc index 7fb4b03b7d..3f3ef37c0d 100644 --- a/components/lazutils/lazfileutils.inc +++ b/components/lazutils/lazfileutils.inc @@ -323,7 +323,7 @@ begin end; //debugln('TryCreaterelativePath: SharedFolders = ',DbgS(SharedFolders)); - if (SharedFolders = 0) and ((not IsAbs) or AlwaysRequireSharedBaseFolder) and not ((CmpDestLen = 0) and (CmpSourceLen = 0)) then + if (SharedFolders = 0) and ((not IsAbs) or AlwaysRequireSharedBaseFolder) and not ((CmpDestLen = 0) or (CmpSourceLen = 0)) then begin //debguln('TryCreaterelativePath: FAIL: IsAbs = ',DbgS(IsAs),' AlwaysRequireSharedBaseFolder = ',DbgS(AlwaysRequireSharedBaseFolder), //' SharedFolders = 0, CmpDestLen = ',DbgS(cmpdestlen),' CmpSourceLen = ',DbgS(CmpSourceLen)); diff --git a/ide/compileroptions.pp b/ide/compileroptions.pp index 58dfc5cc24..9189ae76ce 100644 --- a/ide/compileroptions.pp +++ b/ide/compileroptions.pp @@ -3098,11 +3098,14 @@ begin if NewTargetDirectory <> '' then switches := switches + ' '+PrepareCmdLineOption('-FE' + NewTargetDirectory); NewTargetFileName := ExtractFileName(NewTargetFilename); - if (NewTargetFilename<>'') - and (NewTargetFilename<>ChangeFileExt(ExtractFileName(CurMainSrcFile),GetTargetFileExt)) - then begin - // custom target => pass -o - switches := switches + ' '+PrepareCmdLineOption('-o' + NewTargetFileName); + if (NewTargetFilename<>'') then + begin + if (not TargetFilenameApplyConventions) + or (NewTargetFilename<>ChangeFileExt(ExtractFileName(CurMainSrcFile),GetTargetFileExt)) + then begin + // custom target => pass -o + switches := switches + ' '+PrepareCmdLineOption('-o' + NewTargetFileName); + end; end; end; end;