AUTOMOC use moc --version or another approach instead of the _VERSION variables
Error:
[cmake] CMake Warning (dev) in SerAr/components/QtUI/CMakeLists.txt:
[cmake] AUTOGEN: No valid Qt version found for target QtUI. AUTOMOC disabled.
[cmake] Consider adding:
[cmake]
[cmake] find_package(Qt5 COMPONENTS Core)
[cmake]
[cmake] to your CMakeLists.txt file.
although
[cmake] -- The following REQUIRED packages have been found:
[cmake]
[cmake] *
....
[cmake] * Qt5Core
[cmake] * Qt5Widgets
[cmake] * Qt5Gui
[cmake] * Qt5
...
Reason for error: Qt5Core_(MAJOR|MINOR)_VERSION are not defined in the scope of the target.
Qt provides targets for moc etc (Qt5::moc) instead of using the _VERSION variables I would expect at least a fallback to moc --version
if the target is available or if AUTOMOC_EXECUTABLE
is set to an appropriate value
related issue #19167 (closed)