Boost logo

Boost-Build :

From: Felix E. Klee (felix.klee.jamboost_at_[hidden])
Date: 2003-01-30 08:58:11


Hi,

I'm in the process of converting a project to Boost Build V2. However, one
problem is that Boost Build puts all the object files in the same directory
even if the sources are in different directories. Consider eg. a project
consisting of three files, two of which are named identically:

foo.cpp:
void a_bar();
void b_bar();
int main() {
a_bar();
b_bar();
return 0;
}
a/bar.cpp:
#include <iostream>
void a_bar() { std::cout << "a_bar\n"; }
b/bar.cpp:
#include <iostream>
void b_bar() { std::cout << "b_bar\n"; }

Bjam compiles this just fine but the compilation command for b/bar.cpp
overwrites object file created from a/bar.cpp and when linking I get a
corresponding error message. Here are several solutions that came into my
mind:
1. Purposely call the files a/bar.cpp and b/bar.cpp different, eg.
a/bar_1.cpp and b/bar_2.cpp. I don't like this solution, however, since it
is somewhat ugly. To be consistent and to avoid future problems one might
consider eg. appending a random eight digit number to *each* file name.
2. Flatten out the directory structure, ie. the project should occupy only
one directory. Files would be named foo.cpp, a_bar.cpp, and b_bar.cpp.
This is the solution that I like least since in the original project I will
get to many files in one directory and their names will be extremely long.
There was a reason that I used directories in the first place!
3. Compile each directory into a library. This is the best solution I can
think of but it will result in heaps of libraries when applied to the
original project.

BTW, my directory structure mirrors the namespace structure and the structure
of nested classes. Maybe a solution where the sources for nested classes are
kept in the same directory as their containing classes but different
namespaces are put in different directories is the best. This would be a
compromise between solution 2 and 3.

What do you recommend? Or do you think that Boost Build is the culprit since
it doesn't preserve the directory structure?

Felix

-- 
To contact me personally don't reply but send email to 
felix DOT klee AT inka DOT de
 

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk