[odb-users] Includes and CMake out-of-source builds
boris at codesynthesis.com
Tue Aug 27 06:34:12 EDT 2013
Per Edin <info at peredin.com> writes:
> I'm having some trouble with --include-prefix though. I got CMake to
> figure out the path to the source header and pass that path to
> --include-prefix, this makes the generated employee-odb.hxx include
> the original employee.hxx file correctly:
> #include "/full/path/to/employee.hxx"
> instead of
> #include "employee.hxx"
> But, this also adds the prefix to the generated employee-odb.cxx file
> when it includes employee-odb.hxx:
> #include "/full/path/to/employee-odb.hxx"
> Which of course will never work in this case, since the output
> directory is different from the input directory.
> I'll try to workaround it by messing with include directories and
> --include-with-brackets instead. But, is this behavior by design or
> perhaps a bug?
No, this is by design. The --include-prefix option is means for a
common case where all your headers have a directory prefix (e.g.,
<boost/...>) and you place them all (input and output) in the same
For more complex cases there is the --include-regex option which
allows you to change the prefix based on the included file name
(so you can detect that the file ends with -odb.hxx which will
tell you that it is the generated file). Man pages have more
information on using this option, including an example.
More information about the odb-users