Recent

Author Topic: EXE name  (Read 2615 times)

pcurtis

  • Hero Member
  • *****
  • Posts: 951
EXE name
« on: August 28, 2020, 08:36:24 pm »
Hi All,
simple question.

How do I make the compiled program name the same as the project name and create it in a specific folder?

Thanks.
« Last Edit: August 28, 2020, 08:56:44 pm by pcurtis »
Windows 10 20H2
Laz 2.2.0
FPC 3.2.2

TRon

  • Hero Member
  • *****
  • Posts: 2538
Re: EXE name
« Reply #1 on: August 28, 2020, 09:18:43 pm »
When you create a new application, the IDE will add a form, unit, project-file and some other files for you automatically.

When you save your program for the first time the IDE will ask where you wish to save it, and how to name your project, as well as your unit file(s). The save requester allows you to create a directory anywhere on your disk, and the naming can be done as you wish.

In case you already have the projects saved once and wish to rename it, then just save-as your project using another name. The projects name will be the name of the executable. Using save-as also allows you to save your project into another directory.

Be careful with combining multiple projects into a single folder, as it could cause name-clashes

pcurtis

  • Hero Member
  • *****
  • Posts: 951
Re: EXE name
« Reply #2 on: August 28, 2020, 10:21:03 pm »
Thanks TRon, thats clear. What I thought was I could put a macro in Project Options => Paths => Target file name (-o) to specify the path.

Is that possible?
Windows 10 20H2
Laz 2.2.0
FPC 3.2.2

TRon

  • Hero Member
  • *****
  • Posts: 2538
Re: EXE name
« Reply #3 on: August 28, 2020, 10:26:13 pm »
What I thought was I could put a macro in Project Options => Paths => Target file name (-o) to specify the path.
Is that possible?
Actually -o is for the name only. However you might be able to get away with it, adding a path, but if it does then the path must exist. e.g. the FPC compiler will not create that path for you. I have no idea if and how Lazarus handles this.

zoltanleo

  • Sr. Member
  • ****
  • Posts: 488
Re: EXE name
« Reply #4 on: August 28, 2020, 10:28:44 pm »
Hi All,
simple question.

How do I make the compiled program name the same as the project name and create it in a specific folder?

Thanks.

See attachment. You can just give the name of the output file without macros
Win10 LTSC x64/Deb 11 amd64(gtk2/qt5)/Darwin Cocoa (Monterey):
Lazarus x32/x64 2.3(trunk); FPC 3.3.1 (trunk), FireBird 3.0.10; IBX by TonyW

Sorry for my bad English, I'm using translator ;)

pcurtis

  • Hero Member
  • *****
  • Posts: 951
Re: EXE name
« Reply #5 on: August 28, 2020, 10:33:37 pm »
OK. Thanks all.
Windows 10 20H2
Laz 2.2.0
FPC 3.2.2

zoltanleo

  • Sr. Member
  • ****
  • Posts: 488
Re: EXE name
« Reply #6 on: August 28, 2020, 10:38:56 pm »
For more detail about macro see also https://wiki.lazarus.freepascal.org/IDE_Macros_in_paths_and_filenames

for example
Code: Bash  [Select][+][-]
  1. mydir/$NameOnly($(ProjFile))_$(TargetOS)_$(TargetCPU)
will automatically substitute your_project_name instead of $NameOnly($(ProjFile))
« Last Edit: August 28, 2020, 10:43:21 pm by zoltanleo »
Win10 LTSC x64/Deb 11 amd64(gtk2/qt5)/Darwin Cocoa (Monterey):
Lazarus x32/x64 2.3(trunk); FPC 3.3.1 (trunk), FireBird 3.0.10; IBX by TonyW

Sorry for my bad English, I'm using translator ;)

pcurtis

  • Hero Member
  • *****
  • Posts: 951
Re: EXE name
« Reply #7 on: August 28, 2020, 10:49:06 pm »
Thanks. All is clear.  ;D
Windows 10 20H2
Laz 2.2.0
FPC 3.2.2

 

TinyPortal © 2005-2018