[cmake-developers] Automoc same source - More thoughts
Sebastian Holtermann
seblist at xwmw.org
Tue Apr 12 15:12:42 EDT 2016
Am 12.04.2016 um 17:40 schrieb Sebastian Holtermann:
> Am 12.04.2016 um 13:43 schrieb Sebastian Holtermann:
>> Sorry for the noise.
>>
>>> I've stumbled over bug
>>> https://cmake.org/Bug/view.php?id=12873
>>> a few times now since I like to use same named data/view classes.
>>>
>>> I've prepared a fix that generates all moc_xxx.cpp files
>>> in the foo_automoc.dir subdirectory.
>>
>
> I had some more thoughts about this.
>
> CMAKE_CURRENT_BINARY_DIR /
> foo_automoc.cpp
> foo_automoc.dir/data/moc_item.cpp
> foo_automoc.dir/view/moc_item.cpp
> foo_automoc.dir/moc_item.cpp
>
> With directory based moc file generation it is complicated to allow
> "#include <moc_foo.cpp>" (I've never included mocs btw.).
> Putting every moc directory into the target INCLUDE_DIRECTORIES
> won't help because then there would be multiple moc_item.cpp
> files that match "include <moc_item.cpp>".
> If per source INCLUDE_DIRECTORIES were possible it might work though.
>
> My proposal is this:
>
> - Moc files that are "#include<>"d get generated in
> CMAKE_CURRENT_BINARY_DIR/moc_xxx.cpp as before but with
> name collision test.
>
> - Moc files not included but detected from
> headers get generated in
> CMAKE_CURRENT_BINARY_DIR/foo_automoc.dir/
> with subdirectory support.
> Since they're not included it doesn't matter where they are as long as
> they don't overwrite each other.
>
>
> I'll prepare another patch for this...
Here it is. Please review/commit.
To test it insert #include "moc_item.cpp" in any or many
of the item.cpp files of the attached test project.
Kind regards,
Sebastian Holtermann
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmake_automoc_directory_fix-2016-04-12-3.patch
Type: text/x-patch
Size: 6948 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160412/ada94294/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmake_automoc_directory_test-2016-04-12-2.tar.gz
Type: application/gzip
Size: 1057 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160412/ada94294/attachment-0003.bin>
More information about the cmake-developers
mailing list