Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Compiler Macro IDE Options


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 2 - Last Post: Mar 27, 2016 4:09 AM Last Post By: Hafedh TRIMECHE
Hafedh TRIMECHE

Posts: 107
Registered: 12/29/06
Compiler Macro IDE Options  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 24, 2016 1:08 AM
Delphi Seattle.
The name of Delphi project can be retrieved from .dproj file using the variable $MainSource which returns "ProjectName.dpr".
Which macro would be used to extract only the name of the project (without extension) to include it in the compiler options (Output Directory, Unit output Directory, ...) ?
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Compiler Macro IDE Options  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 24, 2016 10:33 AM   in response to: Hafedh TRIMECHE in response to: Hafedh TRIMECHE
Hafedh wrote:

Which macro would be used to extract only the name of the project
(without extension) to include it in the compiler options (Output
Directory, Unit output Directory, ...) ?

Delphi uses MSBuild, so you can use MSBuild-defined macros, like $MSBuildProjectName:

MSBuildProjectName
The file name of the project file without the file name extension

Refer to MSDN for additional macros:

MSBuild Reserved and Well-Known Properties
https://msdn.microsoft.com/en-us/library/ms164309.aspx

--
Remy Lebeau (TeamB)
Hafedh TRIMECHE

Posts: 107
Registered: 12/29/06
Re: Compiler Macro IDE Options  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 27, 2016 4:09 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:
Hafedh wrote:

Which macro would be used to extract only the name of the project
(without extension) to include it in the compiler options (Output
Directory, Unit output Directory, ...) ?

Delphi uses MSBuild, so you can use MSBuild-defined macros, like $MSBuildProjectName:

MSBuildProjectName
The file name of the project file without the file name extension

Refer to MSDN for additional macros:

MSBuild Reserved and Well-Known Properties
https://msdn.microsoft.com/en-us/library/ms164309.aspx

--
Remy Lebeau (TeamB)

Please note that when running the application form the IDE, the variable is not evaluated and the compiler generated an error with "Could not find program, d:\..%MSBuildProjectName%\Prog.Exe" as a message.

So the project name should be retrieved at the run-time level to be replaced into the output directory value.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02