Page 1 of 1

Naming executable files

Posted: Wed Aug 12, 2009 5:15 am
by Tigers!
Currently Codelite by default names any executables <ProjectName>.exe.
Is it possible to set it up so that it calls the exe <filename>.exe? That would make it easier for me to keep track of what versions I am currently running.

When I right click on the project name I get the <projectName> Project settings tabs come up.
Under the General tab there is the option of Output File:
I assume that this is where I would put what name I would wish. Currently it is $(IntermediateDirectory)/$(ProjectName). See red in attachment.
I would like it to be $(IntermediateDirectory)/$(<FileName>) where FileName is the current active cpp file. See green in attachment.
Is this possible and how would one describe the Output File string required?
Are any other changes in the other tabs required?

Re: Naming executable files

Posted: Wed Aug 12, 2009 11:58 am
by jfouche
Hi

I don't know how this can be done as there is multiple files in a project. Which one is the reference one ? You're talking about the selected one, but if I change the selection, and decide to change the include path in my project settings, what happen ?
Honestly , I'm not sure if this can be done ...
To keep track of the version you're using, you can have a look to the VersionManager Plugin (in my signature)

Re: Naming executable files

Posted: Thu Aug 13, 2009 9:15 am
by Tigers!
There is a cumbersome way to create a <..>.exe file that can follow your <..>.cpp name.
Referring to the attachment - Click on the 'Help' button on the Project Settings will bring up a list of available macroes.
One of those macroes is called ($CurrentFileName). If you replace the ($ProjectName) with ($CurrentFileName) in the Output File: selection then choose 'OK' for once off or 'Apply' for ever after (until you change it again) then when you build the project a file called .exe (no file name, just the extension, .exe) is created.
You can rename that .exe to whatever you want. To keep track of versions I am calling the .exe whatever name the .cpp has.

I have tried it with multiple files in a project and it has allowed me to create multiple .exes. :o


Re: Naming executable files

Posted: Thu Aug 13, 2009 11:42 am
by jfouche
Hi

Looking to CodeLite sources, I can confirm that the macro $(CurrentFileName) is not used during project compilation (but in compile current file). To check, have a look to the folowing function (which does the job):

Code: Select all

 wxString ExpandAllVariables(const wxString &expression, Workspace *workspace, const wxString &projectName, const wxString &selConf, const wxString &fileName)
That seems correct to me not to allow to expand the current file name in project compilation, because what happen in the following cases :
- No file is selected
- when there are project dependancies in a workspace

Maybe you can create multiple configuration, one for each (file) name you need.
I'm not sure to fully understand what you really need, sorry.

Re: Naming executable files

Posted: Thu Aug 13, 2009 12:26 pm
by eranif
jfouche wrote:Hi

Looking to CodeLite sources, I can confirm that the macro $(CurrentFileName) is not used during project compilation (but in compile current file). To check, have a look to the folowing function (which does the job):

Code: Select all

 wxString ExpandAllVariables(const wxString &expression, Workspace *workspace, const wxString &projectName, const wxString &selConf, const wxString &fileName)
That seems correct to me not to allow to expand the current file name in project compilation, because what happen in the following cases :
- No file is selected
- when there are project dependancies in a workspace

Maybe you can create multiple configuration, one for each (file) name you need.
I'm not sure to fully understand what you really need, sorry.
To add on what jfouche wrote, I too cant really understand what you are trying to achieve here, even if codelite will allow you to use $(CurrentFileName), you will get executables with different names, but all are the same, since executable are compiled from the source files of the project.

If you are trying to achieve different executables based on different files, you MUST create different project for each executable, there is no way to workaround it.

Eran

Re: Naming executable files

Posted: Fri Aug 14, 2009 2:41 am
by Tigers!
eranif wrote:
To add on what jfouche wrote, I too cant really understand what you are trying to achieve here, even if codelite will allow you to use $(CurrentFileName), you will get executables with different names, but all are the same, since executable are compiled from the source files of the project.

If you are trying to achieve different executables based on different files, you MUST create different project for each executable, there is no way to workaround it.

Eran
Oh. thank you.