User forums > Help

$workspace_name built-in variable?

<< < (2/3) > >>

fabrizio.benedetti:
Two words on why do I need the workspace_name variable so badly:

My simplified scenario is the following: 3 components, each with its own project. Say, Component1, Component2, Component3. 2 products, each with its Workspace: say, ProductA, ProductB.

ProductA contains Component1 and Component2. ProductB contains Component1 and Component3.

Now, the shared Component(s) are configurable at compile time, by means of some conditional defines. Hence, the resulting dlls or libs will differ. By using the workspace name for composing the output path in the properties of the Component projects, I can direct the build output in the desired path: C:\Builds\ProductA\Component1 or C:\Builds\ProductB\Component1 are expanded from C:\Builds\$(WORKSPACE_NAME)\$(PROJECT_NAME).

Obviously, I also have to use the Workspace name in specifying the additional include paths for the shared Components, so the Components can include the configuration headers specified in the current workspace.

Hope this can be of any help for somebody else!

Ciao!
  Fabrizio

killerbot:
ok, I was unaware there were so many variants  :oops:

thomas:
The practical value or rather validity of variables like WORKSPACE_FILENAME or WORKSPACE_DIR is limited in my opinion, because a workspace does not have any such thing as a directory/location. A workspace is a collection of project files which may be located anywhere. Introducing something like a "workspace directory" suggests that there is some defined hierarchy, which is not the case.

MortenMacFly:

--- Quote from: thomas on July 16, 2008, 06:34:16 pm ---Introducing something like a "workspace directory" suggests that there is some defined hierarchy, which is not the case.

--- End quote ---
Huh? I think he just means the location / name of the C::B *.workspace files. And this *does* exist and is defined.

But: You must not have a workspace. That's where the "default" (virtual) workspace comes into play. In that case the variable would provide nonsense.

thomas:
What I mean is that it may make sense to address a file as $PROJECT_DIR/file.ext or $PROJECT_DIR/../src/file.ext or whatever. That's because there is normally a relation between a project file, its location, and the files in a project. You can of course do it differently on purpose, but naturally it is like that.

For a workspace, that's not the case. A workspace is an arbitrary collection of projects, which may be on different disks or computers, and a single project can even be contained in several workspaces at the same time.
However, when I think of a variable $WORKSPACE_DIR, what intuitively comes to my mind is "the directory under which all the projects in this workspace are found". To me, that's misleading.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version