News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Different linker settings when compiling on different OS

Started by Jyaif, April 24, 2008, 09:41:04 PM

Previous topic - Next topic

Jyaif

Hi,
I have a project that can be compiled under windows and Linux. The problem is that the windows version requires -mingw32 while the linux version doesn't.
Every time I update from my SVN I have to manually remove/add the library. Is there a way to automatize this process?

mariocup

Hi Jyaif,

a solution could be attaching a script to your build targets like:


function SetBuildOptions(base)
{
if(PLATFORM == PLATFORM_MSW)
{
base.AddLinkerOption(_T("your windows option"));
}
        else
        {
base.AddLinkerOption(_T("your linux option"));
}
..
} // end of SetBuildOptions

Bye,

Mario

Jyaif

Fantastic, it works perfectly!

in my case, it was AddLinkLib that I needed ;)

thomas

There's also explicit platform support built-in if you need more than that, for example if you don't just want to change a compiler flag, but maybe also want to compile some platform-dependent files.

Create separate targets for different platforms where needed, and then go to the project's properties, which lets you choose a platform ("All" by default) for every build target.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."