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

Venedict Tchistopolskii venytch at gmail.com
Tue Jan 29 19:16:37 EST 2019


*The below is done right after the above:*
set_property(TARGET ${TargetProject } APPEND PROPERTY AUTOMOC_MOC_OPTIONS
-b${PrecompiledHeader})


On Tue, Jan 29, 2019 at 2:38 PM Venedict Tchistopolskii <venytch at gmail.com>
wrote:

> *Lots more testing, traced down a possible issue here involving PCH and
> mocs_compilation.cpp:*
> get_target_property(HAS_AUTOMOC ${TargetProject} AUTOMOC)
> if (HAS_AUTOMOC STREQUAL "TRUE")
> set (MOC_COMPILATION
> "${CMAKE_CURRENT_BINARY_DIR}/${TargetProject}_autogen/mocs_compilation.cpp")
> # stdafx.h needs to be included to ensure platform definitions are visible
> set_property(SOURCE "${MOC_COMPILATION}" APPEND_STRING PROPERTY
> COMPILE_FLAGS " /FI\"${PrecompiledHeader}\"")
> endif()
>
> *If this is ignored, then mocs_compilation.cpp is visible in solution
> explorer post generation (no need to build). Build ofc proceeds fine, no
> unresolved externals/etc.*
>
> *Please advise.*
>
> *VT*
>
> On Mon, Jan 28, 2019 at 11:25 PM Venedict Tchistopolskii <
> venytch at gmail.com> wrote:
>
>> Current automoc settings more or less, it's a solution with a few
>> projects some of which are marked AUTOMOC:
>> ## Relative to root in solution explorer
>> set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER
>> "${VS_FOLDER_PREFIX}/Sandbox/AUTOMOC_Targets")
>> ## Relative to each project
>> set_property(GLOBAL PROPERTY AUTOGEN_SOURCE_GROUP "AUTOMOC_Generated")
>>
>> AUTOGEN_TARGETS_FOLDER doesn't get created, but in CMake 3.12 it did the
>> same and worked.
>>
>> AUTOMOC_Generated gets created (per project ofc) and added in CMake 3.12
>> during the build.
>> For CMake 3.13 it gets created, but not added (not visible in solution
>> explorer) during build, gotta re-run CMake to include it.
>>
>> On Mon, Jan 28, 2019 at 11:04 PM Venedict Tchistopolskii <
>> venytch at gmail.com> wrote:
>>
>>> tl;dr, the below does not work for me:
>>>
>>> The resulting moc_<basename>.cpp files are generated in custom
>>> directories and automatically included in a generated
>>> <AUTOGEN_BUILD_DIR>/mocs_compilation.cpp file, *which is compiled as
>>> part of the target. (nope....)*
>>>
>>> On Mon, Jan 28, 2019 at 10:06 PM Venedict Tchistopolskii <
>>> venytch at gmail.com> wrote:
>>>
>>>> The first CMake generation pass: Generates but no inclusion
>>>>
>>>>
>>>>
>>>> *Forcing a second pass makes it include the newly generated moc.*
>>>> It says *"AutoMoc: Generating 'XXXXX' because the MOC settings
>>>> changed"*
>>>>
>>>> I'm not too clear on why this is happening, any ideas on how to fix it,
>>>> or force it to reload whatever 'moc settings' are changing?
>>>>
>>>> Possibly related: https://gitlab.kitware.com/cmake/cmake/issues/17456
>>>>
>>>> e.g. mocs_compilation.cpp and include_XXXX folder -> Created but not
>>>> added until CMake re-run....
>>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake-developers/attachments/20190129/f522cfa3/attachment.html>


More information about the cmake-developers mailing list