Problem with AUTOMOC on WIN32

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with AUTOMOC on WIN32

Michael Wild
Dear all

It's a very long time I last posted here, so please be kind :-)

I currently am having a very hard time to get AUTOMOC to work properly
on WIN32 for the case where I have some Qt classes in a DLL that I
link to an executable. In this case, the header gets included by both,
the corresponding *.cpp file in the DLL and the importing *.cpp file
in the executable. The problem is now that the AUTOMOC feature runs
moc twice on the same header, once for the DLL and once for the
executable, resulting in an inconsistent linkage because for the DLL
the moc'ed sources are dllexport but for the executable they are
dllimport.

I put together a minimal example exhibiting the problem:
https://github.com/themiwi/qt_cmake_automoc_test/

Is this a bug in CMake? IMHO moc should be only run on headers for
targets where the corresponding source file is compiled in. Or am I
just being incredibly stupid and completely miss an obvious point?

Of course I could revert to qt5_wrap_cpp() as demonstrated in the
develop branch of above example, but I'd rather not because that adds
considerable complexity and makes configuration much slower in a
real-world project.

Cheers

Michael
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Problem with AUTOMOC on WIN32

Innokentiy Alaytsev
Hello!

Are the header files of the shared library (DLL) listed as INTERFACE_SOURCES
for the library target? AFAIK, the only reason for header files to be
processed by AUTOMOC is to be part of the project. The only way that I know
of for adding library headers to the consuming project is by declaring them
as INTERFACE sources of the library target.

Best regards,
Innokentiy Alaytsev



--
Sent from: http://cmake.3232098.n2.nabble.com/
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake