Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: AndyJ on November 24, 2009, 11:49:05 am

Title: Workspace Variables
Post by: AndyJ on November 24, 2009, 11:49:05 am
Does CodeBlocks support variables defined as part of the workspace? From what I've seen so far I can define global variables (part of the application such as #wx) or project variables (compiler defines etc), but not ones that apply to all projects within a particular workspace.

One reason for wanting this is that I have embedded applications that comprise the same set of projects, but are targeted at different platforms and it would be great to just be able to have a different workspace for each platform which does something equivalent to adding -DBUILDFORPLATFORMX to all the projects within the workspace.

Thanks for any help,

Andy
Title: Re: Workspace Variables
Post by: stahta01 on November 24, 2009, 04:14:14 pm
Have you looked at targets?
Because there is no workspace wide MACRO defines.

Tim S.
Title: Re: Workspace Variables
Post by: AndyJ on November 24, 2009, 05:06:22 pm
Have you looked at targets?

I have, but it doesn't seem like it will do the same thing. I might be misunderstanding, but if I use targets then I will have to create a new target for every possible combination in every project. As I have workspaces containing 10+ different projects and a similar number of potential targets (treating debug/release versions as 2), most of which are very similar apart from a few global defines it seems like a very messy solution.

Of course I could be completely missing the obvious....

Thanks for the help,

Andy
Title: Re: Workspace Variables
Post by: stahta01 on November 24, 2009, 05:19:55 pm
You could also; just create a project that just creates an header file that is used by all the other projects; this is the way many non Code::Blocks based projects are done.

Tim S.
Title: Re: Workspace Variables
Post by: AndyJ on November 24, 2009, 05:59:18 pm
You could also; just create a project that just creates an header file that is used by all the other projects

That seems like an interesting approach - I'll investigate further.

Thanks for the idea!

Andy