Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: vri on January 27, 2009, 03:14:26 pm

Title: build options for targets being developed in both windows and linux
Post by: vri on January 27, 2009, 03:14:26 pm
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
Title: Re: build options for targets being developed in both windows and linux
Post by: Jenna 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)"));]]
Title: Re: build options for targets being developed in both windows and linux
Post by: vri on January 27, 2009, 05:05:35 pm
Works perfectly so far, thank you!

Theo.
Title: Re: build options for targets being developed in both windows and linux
Post by: vri 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.
Title: Re: build options for targets being developed in both windows and linux
Post by: Jenna on January 28, 2009, 04:12:21 pm
Code
[[if (PLATFORM == PLATFORM_MSW) print(_T("$(#boost)")) else print (_T("."));]]
Title: Re: build options for targets being developed in both windows and linux
Post by: vri on January 28, 2009, 04:47:22 pm
Sigh... how obvious...

and I pretend to be a programmer...

Thanks again!

Theo.
Title: Re: build options for targets being developed in both windows and linux
Post by: vri 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 (http://forums.codeblocks.org/index.php/topic,8643.msg63221.html#msg63221)

helpful as well.