• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Copyright 2005 Vladimir Prus
2Distributed under the Boost Software License, Version 1.0.
3(See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
4
5
6Hi,
7recently, we had a couple of problems caused by using relative file paths, and
8I'd like to discuss what to do.
9
10Let's use the case from C�dric. Simplified version is:
11
12    exe a : a.cpp dir1/qt_file.h ;
13    exe b : a.cpp dir2/qt_file.h ;
14
15Both exes have the same source cpp file but different *.h files -- which are
16processed by Qt tools. V2 currently strips directory name from all targets,
17so it tries to
18
19   - create "bin/mvsc/debug/moc_qt_file.cpp" from dir1/qt_file.h
20   - create "bin/msvc/debug/moc_qt_file.cpp" from dir2/qt_file.h
21
22There are two solutions that I see:
23
24   1. Rewrite the code like:
25
26      lib aux : a.cpp
27      exe a : aux dir1/qt_file.h : <location-prefix>a ;
28      exe b : aux dir2/qt_file.h : <location-prefix>b ;
29
30    This way, two version of moc_qt_file.cpp will be generated to different
31    places.
32
33  2. Rewrite the code like:
34
35      obj a_moc : dir1/qt_file.h : <library>/qt//qt ;
36      exe a : a.cpp a_moc ;
37      obj b_moc : dir2/qt_file.h : <library>/qt//qt ;
38      exe b : a.cpp b_moc ;
39
40     Explicitly changing name for the problematic files.
41
42  3. Generally change V2 so that directory part of source is preserved. This
43      will generate targets:
44     "bin/msvc/debug/dir1/moc_qt_file.cpp" and
45     "bin/msvc/debug/dir2/moc_qt_file.cpp". No problems.
46
47   However, there are some additional questions:
48
49       - What if source has absolute file name?
50       - What if source is "../../include/qt_file.h"?
51
52       We can ignore directory names in those cases (i.e. use the current
53       behaviour) but that would be a bit inconsistent.
54
55Any opinions?
56
57Pedro Ferreira:
58
59I think this is a corner case and BB should not try to solve everything
60automatically - otherwise it will become really complex.
61I don't see a problem in requiring the user to help the build system by
62using solutions 1 or 2.
63Of course, the better the error reporting, the easier it will be to
64find the cause and the cure of the problem.
65
66TEMPLIE Cedric:
67
68I agree with Pedro. Solution 1 or 2 is the best way to deal with this
69problem. Of course I have a preference for the solution 1, but the
70solution 2 has the advantage to work without any modification...
71
72Toon Knapen:
73
74I agree.
75
76
77