[odb-users] Includes and CMake out-of-source builds
Per Edin
info at peredin.com
Mon Aug 26 19:57:37 EDT 2013
Hi,
I've changed the sloc support. It is now possible to set a sloc limit
when adding ODB headers to a project, but instead of always passing
--sloc-limit to odb I decided to create a special "check_sloc" target.
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?
Per
On Mon, Aug 26, 2013 at 3:05 PM, Boris Kolpackov
<boris at codesynthesis.com> wrote:
> Hi Per,
>
> Per Edin <info at peredin.com> writes:
>
>> ... except when SLOC_LIMIT is specified. In that case all input files
>> are passed to ODB at once. Having the output directory logic in ODB
>> itself would allow --sloc-limit / --show-sloc to work while fixing
>> the directory/include problem.
>
> One way to work around the SLOC problem is to specify the limit on
> the per file basis. For example, GNU make has target-specific
> variables so one could do:
>
> # Total should not exceed 10,000.
> #
> foo.hxx: sloc_limit := 4000
> bar.hxx: sloc_limit := 6000
>
> %-odb.hxx %-odb.ixx %-odb.cxx: %.hxx
> odb --sloc-limit $(sloc_limit) ...
>
> Or, you could do something like this:
>
> foo_sloc_limit := 4000
> bar_sloc_limit := 6000
>
> And then use the file name to form the variable name:
>
> %-odb.hxx %-odb.ixx %-odb.cxx: %.hxx
> odb --sloc-limit $(value $*_sloc_limit) ...
>
> While not as nice as having a single limit for all the files applied
> automatically, I think this is workable.
>
> Boris
More information about the odb-users
mailing list