Platform specific (MinGW) linking?

General questions regarding the usage of CodeLite
andy_westken
CodeLite Curious
Posts: 2
Joined: Mon Nov 22, 2010 2:25 am
Genuine User: Yes
IDE Question: C++
Contact:

Platform specific (MinGW) linking?

Post by andy_westken »

Hi

I'm pretty new to Linux (Ubuntu) development but have done quite a bit of work on Windows using Visual Studio, so I know the basics of C++, etc. I found CodeLite while looking for a fully-featured IDE for Linux-based development which had good debugger support, and I am more than happy with it! :-)

I have been using the same CodeLite project files - via source control - on both my Ubuntu and Windows machines; using the MinGW tools on the latter. Everything was going really well with my little projects until I started to use regex. With MinGW I need to add the regex library (libregex.dll.a) to the Linker/Libraries option. But this doesn't build on Ubuntu.

Is there a way to tell CodeLite that I want to link to libregex.dll.a when I'm using MinGW, but not otherwise, without having to use a custom makefile (with a makefile I can use ifdef MSYSCON).

Thanks, Andy
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Platform specific (MinGW) linking?

Post by eranif »

andy_westken wrote: Is there a way to tell CodeLite that I want to link to libregex.dll.a when I'm using MinGW, but not otherwise, without having to use a custom makefile (with a makefile I can use ifdef MSYSCON).
You need to define a new build configuration.

For the sake of the example, lets assume that you have 1 project named "A" with a single configuration named "Debug".
So what we are trying to do is to add a new workspace configuration so that when selecting it, it will build without libregex.dll.a.

So we need to create a new "workspace configuration", followed by new project build configuration and "connect" between the two.

1) From the main menu: "Build | Configuration Manager..."
2) from the drop down button that says "Workspace configuration" select the option "<New...>", give it a name and close the dialog (e.g. DebugLinux")
3) select the newly created workspace configuration
4) For the project "A", use the drop down button and select the option "<New..>"
5) In the dialog that shows, give the new project build configuration a name (e.g. DebugLinux) and in the "Copy settings from:" drop down button, select "Debug" -> this will instruct codelite to copy the settings from the "Debug" configuration into the newly created "DebugLinux" build configuration. Click OK and dismiss that dialog
6) Back in the "Configuration Manager" dialog, select the newly created workspace configuration along with the newly created project configurtation, so all the drop down buttons in the dialog will say: "DebugLinux" click Apply and close that dialog
7) In the drop down on top of the workspace view, select the newly created workspace configuration "DebugLinux", next, open the project settings and remove libregex.dll.a from the link options

So, to build for Windows, select "Debug", and when on Linux, select "DebugLinux" this way you can add / removed any option you want for each platform.

There is also this wiki entry:
http://codelite.org/LiteEditor/ConfigurationManager

Eran
Make sure you have read the HOW TO POST thread
andy_westken
CodeLite Curious
Posts: 2
Joined: Mon Nov 22, 2010 2:25 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Platform specific (MinGW) linking?

Post by andy_westken »

Thanks very much for your help.

All up and running now! :-)

Andy
Post Reply