Page 1 of 1

Multiple targets in the same project

Posted: Fri Mar 30, 2012 1:11 am
by tankist02
Suppose I want to build both static and shared libraries from the same sources using one project. Those libraries would output into different directories. Everything else is the same - compiler flags, object files, etc. What would be the simplest way to achieve that?

Using "raw" makefiles it was easy - I just added an additional target (static lib) with its own command to link statically and place output into a different location. Now I need to do the same using Codelite build system.

Re: Multiple targets in the same project

Posted: Fri Mar 30, 2012 11:48 am
by eranif
To create 2 different targets you need to define new build configuration. (codelite's build configuration is similar to a makefiles' target)

Assuming that you have one project A with one build configuration Debug_Dll and you want to create new configuration 'Debug_Static' which have the same settings as the 'Debug_Dll' configuration:

First you define new workspace configuration:

0) Open the configuration manager dialog from Build -> Configuration Manager
1) In the configuration Manager dialog, open the upper selection box (the one with the title 'Workspace Configuration') and select the option <New...>, in the dialog that comes up type the name of the workspace configuration (e.g. Debug_Static) and click OK

Next you define new project configuration:
0) Open the configuration manager dialog from Build -> Configuration Manager
1) Select the selection box at the top of the workspace view (the one which says 'Release' , 'Debug' etc) and select the option '<Open Configuration Manager..>'
2) In the dialog the comes up, Open the selection box of your project and select the option '<New...>'
3) In the 'New Configuration' dialog that pops up, type the name of the new configuration (i.e. Debug_Static) and select the build configuration that you want the settings to be copied from (i.e. Debug_Dll) and click 'OK'

Now all left to be done is to associate the workspace configuration with the project configuration:

0) Open the configuration manager dialog from Build -> Configuration Manager
1) In the upper selection box select the new workspace configuration 'Debug_Static'
2) Next, select the 'Debug_Static' for configuration for your project and click 'Apply'

Close and dismiss the configuration manager dialog.


Now, to switch 'targets' all you need to do is to select the desired configuration from the upper selection box.

Last thing to do is to change the project type from DLL to Static library:
Right click on your project and open the project settings dialog, on the first page, change the project type from 'Dynamic Library' to 'Static Library'.
Also remember to change the 'Output File'

You can read more here:
http://www.codelite.org/LiteEditor/ConfigurationManager

Eran

Re: Multiple targets in the same project

Posted: Wed Apr 11, 2012 3:57 am
by tankist02
Thank you very much for the detailed explanation.