I have C++ project that are built using Boost.Build. The project consists of 3 subprojects.
. [root]
\-- source
\-- common
\-- config
\-- config.cpp
\-- project_1
\-- Jamfile.jam
\-- project_2
\-- Jamfile.jam
\-- project_3
\-- Jamfile.jam
\-- Jamroot.jam
Jamroot.jam:
project my_project
: requirements
multi
debug:DEBUG
: default-build
static
: build-dir bin
;
alias project_1 : source/project_1 ;
alias project_2 : source/project_2 ;
alias project_3 : source/project_3 ;
install dist : project_1 project_2 project_3
: on EXE
;
Each project has Jamfile.jam according to this template:
project project_N
: requirements
CONFIG_DEFINE_1=
CONFIG_DEFINE_2=
;
lib config : [ glob ../common/config/*.cpp ] ;
exe project_N
: [ glob *.cpp ] config
:
;
config.cpp uses defines CONFIG_DEFINE_1 and CONFIG_DEFINE_2 for conditional compilation (actually they are simply constants), so there's a separate version of config library per project.
The problem is that such approach causes the config library to be rebuilt each time the whole project is built regardless of were the files changed or not. I.e. building the first time everything is compiled and linked, building the second time without doing any modifications - only the config library is built for each project_N. How should I properly setup the building so no redundand compilation occur?