Author Topic: Workspace Variables  (Read 2767 times)

Offline AndyJ

  • Multiple posting newcomer
  • *
  • Posts: 15
Workspace Variables
« 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

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6678
    • My Best Post
Re: Workspace Variables
« Reply #1 on: November 24, 2009, 04:14:14 pm »
Have you looked at targets?
Because there is no workspace wide MACRO defines.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline AndyJ

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Workspace Variables
« Reply #2 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

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6678
    • My Best Post
Re: Workspace Variables
« Reply #3 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.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline AndyJ

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Workspace Variables
« Reply #4 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