[cmake-developers] CMake 3.13 - Generated moc files not added to VStudio solution

Venedict Tchistopolskii venytch at gmail.com
Thu Jan 31 13:11:50 EST 2019


Thanks! Worked, glad to have a smaller fix.

VT

On Thu, Jan 31, 2019 at 9:10 AM Sebastian Holtermann <seblist at xwmw.org>
wrote:

> > Any luck? I can try helping ya trace it if you need it.
> >
>
> I traced this down to some degree.
> The problem arises from the handling of file path for GENERATED vs non
> GENERATED files.
> When the full path for a file is computed in cmSourceFile and the file
> doesn't
> exist (mocs_compilation.cpp doesn't, yet), a path error flag is set.
> The flag won't be raised when the file has the property GENERATED set,
> which
> mocs_compilation.cpp hasn't at that point.
>
> A quick solution in your CMakeLists.txt is to mark mocs_compilation.cpp
> GENERATED first like this
>
> ```
> set_property(SOURCE "${MOC_COMPILATION}" APPEND_STRING PROPERTY GENERATED
> "1")
> set_property(SOURCE "${MOC_COMPILATION}" APPEND_STRING PROPERTY
> COMPILE_FLAGS
> " /FI\"${PrecompiledHeader}\"")
> ```
>
> This works here for a small example project.
>
> I'm too busy right now to address this in the CMake sources but I'll try
> to
> look at it next week.
>
> -Sebastian
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake-developers/attachments/20190131/d7c7627a/attachment.html>


More information about the cmake-developers mailing list