Wiki copymirror

This is a mirror of the wiki at pascal.chat. Editing, history and sign-in are there.

IDE Macros in paths and filenames

Deutsch · English · Español · Français · Português · Русский

Types of Macros

There are various types of macros:

IDE macro format

IDE macros are used in the following format. Replace the macro-name part with one of the macros listed below.

text
$(macro-name)

For example: This "Unit Output directory" is often used for Lazarus Packages:

text
lib/$(TargetCPU)-$(TargetOS)

There are also some macro functions that use the following format:

text
$macro_name(parameters)

For example

text
$Ext(unit1.pas)

will give .pas.

Windows: Compiling to a RamDrive where each project gets its own unit directory (Project> Options> Unit Output Directory)

text
 R:\FPC\$NameOnly($(ProjFile))

MacOS: A more complex example but very useful, when you want to compile on its name $NameOnly($(ProjFile)) on a specific CPU target -$(TargetCPU)'' saving the compiled file on the package path**.app/Contents/MacOS/**''

text
$NameOnly($(ProjFile))-$(TargetCPU).app/Contents/MacOS/$NameOnly($(ProjFile))-$(TargetCPU)

General Purpose

Filename Parts

Paths and Parts

Environment

Macros in IDE addons

Here is an incomplete list of macros added by IDE packages:

Pas2jsDsgn

ProjectGroups

Delphi compiler tool


From the Free Pascal wiki, page "IDE Macros in paths and filenames", as it stood on 2024-03-28 after a change by Mattias2, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 3, last changed by WikiArchive .