Workspace file

From Code::Blocks

The workspace XML file is a very simple one.

A workspace is a collection of projects. Essentially the workspace file does exactly that: describes a collection of projects. But let's see the contents of a sample workspace:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_workspace_file>
	<Workspace title="Test Workspace">
		<Project filename="TestConsole/TestConsole.cbp" active="1">
			<Depends filename="TestLib/TestLib.cbp" />
		</Project>
		<Project filename="TestLib/TestLib.cbp" />
	</Workspace>
</CodeBlocks_workspace_file>

This XML text defines the workspace named "Test Workspace" containing two projects:

  • TestConsole/TestConsole.cbp and
  • TestLib/TestLib.cbp

Additionally, it defines a project dependency: the TestConsole project depends on the TestLib project. This instructs Code::Blocks to always make sure that the TestLib project is built before the TestConsole project.

NOTE: This is a build-order dependency that is being set. This will _not_ force a re-link of the TestConsole output (which is an executable) when the library generated by TestLib is updated. This behavior is influenced by another setting in the project file. See the Project file description for this.

Well, I 'd love to add various comments in the XML itself, to describe each element, but as you see it's pretty simple and straightforward :). The only thing that requires perhaps some explanation is the "active" attribute seen in the "Project" element for the TestConsole project. That attribute appears only when its value equals to "1" and in only one "Project" element inside the workspace. All it does is define which of the workspace projects will be the active one by default, when opening the workspace in Code::Blocks.


That's all.

Mandrav 11:59, 1 March 2007 (UTC)