cotire
cotire copied to clipboard
CMake-3.9.0 broke automoc again. (was: CMake 3.8.0-rc2 broke automoc)
it seems that all the target names, folders, files, etc. changed.
See for instance :
- https://cmake.org/cmake/help/v3.8/manual/cmake-qt.7.html#manual:cmake-qt(7) (section AUTOMOC),
- https://github.com/Kitware/CMake/commit/dfebdd6218d8f146277d75597fccde74b45cdbd2
and specifically
- https://github.com/Kitware/CMake/commit/9d1db7d7c3696108fd0fa1162893076d9a59b652
Changing : https://github.com/sakra/cotire/blob/master/CMake/cotire.cmake#L2992
list (APPEND _unityTargetSources "${_target}_automoc.cpp")
set_property (SOURCE "${_target}_automoc.cpp" PROPERTY GENERATED TRUE)
into
list (APPEND _unityTargetSources "${_target}_autogen/moc_compilation.cpp")
set_property (SOURCE "${_target}_autogen/moc_compilation.cpp" PROPERTY GENERATED TRUE)
seems to make my build pass, but maybe there is more to do... besides this wouldn't be backwards-compatible
thanks @bilke !
god dammit... CMake 3.9.0 broke it again. Now it's called mocs_compilation.cpp.
even better: it's becoming $<CONFIG>-dependent:
https://gitlab.kitware.com/cmake/cmake/commit/d7e1b93f23df9c6cfd79fc650ed2a5d8682b3d2a
seems to build when replacing
if (CMAKE_VERSION VERSION_LESS "3.8.0")
list (APPEND _unityTargetSources "${_target}_automoc.cpp")
set_property (SOURCE "${_target}_automoc.cpp" PROPERTY GENERATED TRUE)
else()
list (APPEND _unityTargetSources "${_target}_autogen/moc_compilation.cpp")
set_property (SOURCE "${_target}_autogen/moc_compilation.cpp" PROPERTY GENERATED TRUE)
endif()
with
if (CMAKE_VERSION VERSION_LESS "3.8.0")
list (APPEND _unityTargetSources "${_target}_automoc.cpp")
set_property (SOURCE "${_target}_automoc.cpp" PROPERTY GENERATED TRUE)
elseif(CMAKE_VERSION VERSION_LESS "3.9.0")
list (APPEND _unityTargetSources "${_target}_autogen/moc_compilation.cpp")
set_property (SOURCE "${_target}_autogen/moc_compilation.cpp" PROPERTY GENERATED TRUE)
else()
if("${CMAKE_CONFIGURATION_TYPES}" MATCHES "")
set(_mocFiles "${_target}_autogen/mocs_compilation.cpp")
else()
set(_mocFiles "${_target}_autogen/mocs_compilation_$<CONFIG>.cpp")
endif()
list (APPEND _unityTargetSources ${_mocFiles})
set_property (SOURCE ${_mocFiles} PROPERTY GENERATED TRUE)
endif()
at line https://github.com/sakra/cotire/blob/master/CMake/cotire.cmake#L3029
Hi
I had similar problems after upgrading to CMake 3.9, the above fix solved them.
From the changelogs I could read, I fear that the upcoming 3.10 update will break this again.... @sebholt would it be possible to keep this kind of stuff a bit more stable ?
It's not easy to find a solution that fits all needs.
Btw., did you even encounter a (custom) generator that produces mocs_compilation_$<CONFIG>.cpp in CMake 3.9.x?
Technically it's in the CMake code but for the two generators that support multi configuration (VS and XCode) it's disabled because neither does support per-config sources.
That situation doesn't change in in CMake 3.10 where the compilation file still is "${_target}_autogen/mocs_compilation.cpp"
Technically it's in the CMake code but for the two generators that support multi configuration (VS and XCode) it's disabled because neither does support per-config sources.
Okay, it "just worked" and I found it a bit weird so this case not really happening in practice has been a good thing :p
That situation doesn't change in in CMake 3.10 where the compilation file still is "${_target}_autogen/mocs_compilation.cpp"
Cool, thanks!