[Interest] Qt automoc (CMAKE_AUTOMOC) failure with name clashes
Lisandro Damián Nicanor Pérez Meyer
perezmeyer at gmail.com
Tue Jan 20 03:11:44 CET 2015
On Sunday 14 December 2014 20:58:58 Roger Leigh wrote:
> I brought this up on the cmake list, since I think this is likely an
> issue with the cmake automoc implementation, but also posting here
> since it's primarily an issue when using Qt.
>
> I have a source directory layout like this:
> ├── gl
> │ ├── Axis2D.h
> │ ├── Grid2D.h
> │ ├── Image2D.h
> │ └── v20
> │ ├── Axis2D.h
> │ ├── Grid2D.h
> │ └── Image2D.h
> ├── GLContainer.h
> ├── glsl
> │ └── v110
> │ ├── GLFlatShader2D.h
> │ ├── GLImageShader2D.h
> │ └── GLLineShader2D.h
> ├── GLUtil.h
> ├── GLView2D.h
> ├── GLWindow.h
> └── TexelProperties.h
>
> And use this cmake configuration:
>
> set(CMAKE_AUTOMOC ON)
> set(CMAKE_INCLUDE_CURRENT_DIR ON)
> set(QTWIDGETS_GL_HEADERS
> gl/Axis2D.h
> gl/Grid2D.h
> gl/Image2D.h)
> set(QTWIDGETS_GL_V20_HEADERS
> gl/v20/Axis2D.h
> gl/v20/Grid2D.h
> gl/v20/Image2D.h)
>
> As you can see, the names are duplicated in the two subdirectories.
> I plan to have even more dupliated names as I add support for
> multiple gl/glsl versions.
> Unfortunately, cmake automoc generates this:
>
> /* This file is autogenerated, do not edit*/
> #include "moc_GLContainer.cpp"
> #include "moc_GLView2D.cpp"
> #include "moc_GLWindow.cpp"
> #include "moc_Axis2D.cpp"
> #include "moc_Grid2D.cpp"
> #include "moc_Image2D.cpp"
> #include "moc_Axis2D.cpp"
> #include "moc_Grid2D.cpp"
> #include "moc_Image2D.cpp"
> #include "moc_GLFlatShader2D.cpp"
> #include "moc_GLImageShader2D.cpp"
> #include "moc_GLLineShader2D.cpp"
>
> Compilation inevitably fails due to it including the generated source
> files twice. It's discarded the path information and overwritten the
> generated sources where the names clash.
>
> - I've seen some old posts to this list and in other places which show
> this has been an issue historically, and the suggestion has been to
> rename the source/header files. However, that's not always possible
> or acceptable. In this case, it's definitely not. There's no problem
> with the sources/headers themselves, which are correct, just with moc.
> - is there any way to get automoc support to add the full pathname to
> the generated sources e.g. moc_gl_Axis2D.cpp and moc_gl_v20_Axis2D.cpp.
> - any workarounds with cmake known for this issue?
Hi Roger! Did you find a solution?
--
Q. How did the programmer die in the shower?
A. He read the shampoo bottle instructions: Lather. Rinse. Repeat.
http://www.devtopics.com/best-programming-jokes/
Lisandro Damián Nicanor Pérez Meyer
http://perezmeyer.com.ar/
http://perezmeyer.blogspot.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150119/cc61b0fc/attachment.sig>
More information about the Interest
mailing list