Author Topic: build options for targets being developed in both windows and linux  (Read 3989 times)

Offline vri

  • Multiple posting newcomer
  • *
  • Posts: 18
We are working on a project for an app that should run in both windows and linux. Development is being done on both platforms, using gcc and mingw. Codeblocks is great for this!

I have a small problem, however. We make use of boost and some other libs. Under windows, I need to set a -I option for the include path for that, I do this using a global variable $(#boost). Under linux, this is not needed. The unfortunate thing is that if I open the project under linux, CB insists on setting a global variable $(#boost), which I'd rather not do. Actually, I have a whole list of them in my workspace, and I seem to be unable to continue in a decent way unless I do specify them.

So my question is two-fold:
- can I specify compiler options (-I) and/or linker options in a project for a specific platform only (without making the target compiler-specific, which is undesired in my case)?
- can I somehow ignore or invalidate global variables when opening a project or workspace?

Thanks, Theo.

P.S. CB 8.02, gcc & mingw, XP and ArchLinux

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: build options for targets being developed in both windows and linux
« Reply #1 on: January 27, 2009, 03:47:11 pm »
You can try to use something like this as search-directory:
Code
[[if (PLATFORM == PLATFORM_MSW) print(_T("$(#boost)"));]]

Offline vri

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: build options for targets being developed in both windows and linux
« Reply #2 on: January 27, 2009, 05:05:35 pm »
Works perfectly so far, thank you!

Theo.

Offline vri

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: build options for targets being developed in both windows and linux
« Reply #3 on: January 28, 2009, 03:29:20 pm »
Sorry to bother you again...

Yesterday it worked...
This morning, I upgraded my linux box to gcc 4.3.3
And now, it apparently doesn't work anymore. It seems that the empty compiler directive "-I" that results on linux leads to problems during the linking step afterwards. I get errors like "multiple definitions of `_start' ".

Any ideas?

Theo.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: build options for targets being developed in both windows and linux
« Reply #4 on: January 28, 2009, 04:12:21 pm »
Code
[[if (PLATFORM == PLATFORM_MSW) print(_T("$(#boost)")) else print (_T("."));]]

Offline vri

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: build options for targets being developed in both windows and linux
« Reply #5 on: January 28, 2009, 04:47:22 pm »
Sigh... how obvious...

and I pretend to be a programmer...

Thanks again!

Theo.

Offline vri

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: build options for targets being developed in both windows and linux
« Reply #6 on: January 28, 2009, 11:17:14 pm »
Further answering my own question: I remembered having read about this before, just didn't manage to find the thread.
But now I did:
http://forums.codeblocks.org/index.php/topic,8643.msg63221.html#msg63221

helpful as well.