User forums > Using Code::Blocks

Different linker settings when compiling on different OS

(1/1)

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:


--- Code: ---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
--- End code ---

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.

Navigation

[0] Message Index

Go to full version