Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: erodriguez on January 12, 2008, 11:27:02 pm

Title: Project settings inheritance
Post by: erodriguez on January 12, 2008, 11:27:02 pm
Is there a mechanism to allow one project to inherit setting from another project. 

For example, project b depends on project a.  Project a sets its include paths and compiler defines, which will be necessary for building project b.  I'm looking for something similar to vsprops files in DevStudio 2005 or xcconfig files in XCode. 

Such a facility is really handy when dealing with large numbers of projects (I'm working with about 200) since it allows certain settings - compiler optimizations flags, global defines, output paths, etc to be specified in a single location which all projects can share.
Title: Re: Project settings inheritance
Post by: mandrav on January 13, 2008, 12:38:46 am
Is there a mechanism to allow one project to inherit setting from another project. 

For example, project b depends on project a.  Project a sets its include paths and compiler defines, which will be necessary for building project b.  I'm looking for something similar to vsprops files in DevStudio 2005 or xcconfig files in XCode. 

Such a facility is really handy when dealing with large numbers of projects (I'm working with about 200) since it allows certain settings - compiler optimizations flags, global defines, output paths, etc to be specified in a single location which all projects can share.

Have a look at this (http://wiki.codeblocks.org/index.php?title=Build_scripts).
Title: Re: Project settings inheritance
Post by: erodriguez on April 11, 2008, 05:46:15 am
Is it possible for a build script to include another one.  I'd like to be able to create a configuration specific script which then includes additional settings.  I tried using 'dofile' and 'loadfile' without success.

Something like:
bdstr_debug.script:
dofile(_T("../../../../../Project/make/CB/debug.script")) ;

local BDSTR_INCLUDE = ::wxArrayString();
BDSTR_INCLUDE.Add(_T("../../../../../Project/bdstr/include"), 1) ;

function SetBuildOptions(base)
{
   base.SetIncludeDirs(BDSTR_INCLUDE) ;
}

debug.script:
function SetBuildOptions(base)
{
    // enable debugging symbols
    base.AddCompilerOption(_T("-g"));
    // disable all optimizations
    base.AddCompilerOption(_T("-O0"));
}

Title: Re: Project settings inheritance
Post by: mariocup on April 11, 2008, 09:26:15 am
Hi erodrizguez,

you can include scripts in other scripts like this

Code
Include(_T("..") + wxFILE_SEP_PATH + _T("flash.script"));

Bye,

Mario
Title: Re: Project settings inheritance
Post by: mandrav on April 11, 2008, 10:03:01 am
As mariocup said, Include() and Require() are supported (with Require() being the same as Include() with the exception that it raises an error if the file can't be found).