Author Topic: Different linker settings when compiling on different OS  (Read 3895 times)

Offline Jyaif

  • Single posting newcomer
  • *
  • Posts: 3
Different linker settings when compiling on different OS
« on: April 24, 2008, 09:41:04 pm »
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

  • Guest
Re: Different linker settings when compiling on different OS
« Reply #1 on: April 24, 2008, 11:17:37 pm »
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

Offline Jyaif

  • Single posting newcomer
  • *
  • Posts: 3
Re: Different linker settings when compiling on different OS
« Reply #2 on: April 25, 2008, 12:01:59 am »
Fantastic, it works perfectly!

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

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Different linker settings when compiling on different OS
« Reply #3 on: April 25, 2008, 09:47:32 am »
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."