Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: msturner on September 18, 2012, 07:54:54 am

Title: Shared source folder, multiple projects
Post by: msturner on September 18, 2012, 07:54:54 am
Hi all,

I have several projects that share a common folder of source files - a "library" of utility functions and classes. These are C/C++ source files, not compiled LIBs. This arrangement allows me to freely modify the shared functions, and all projects that make use of those shared source files immediately benefit from the updates. I am a single developer with full control over all the projects concerned.

This arrangement is complicated by the way Code::Blocks project files store and present paths to source files. I cannot freely move projects to other folders without breaking paths to the shared source files. There are many source files, which makes updating paths to each file a chore. Often the best solution is to open the CBP project file in another text editor and do a find-and-replace. It would be handy if file paths could be relative to some kind of environment variable.

I am wondering if anyone has a good solution to this problem, or can describe their own methods for sharing code between project files.

Thanks in advance.
Title: Re: Shared source folder, multiple projects
Post by: oBFusCATed on September 18, 2012, 08:34:52 am
Try this: http://wiki.codeblocks.org/index.php?title=Global_compiler_variables
Title: Re: Shared source folder, multiple projects
Post by: jarod42 on September 18, 2012, 11:46:20 am
- With a real library, you other projects also benefit from changes (and compilation should be faster since the library is compiled only once).

I personally use Premake (http://industriousone.com/premake) to generate my project,
so it is easy to reorganize source tree and then regenerate project.