Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COMP: Update ctkMacroGenerateMocs to fix warnings using qt5_generate_moc #1007

Merged

Conversation

jcfr
Copy link
Member

@jcfr jcfr commented Nov 4, 2021

This commit prepare the transition to Qt6 by fixing warnings like the following:

  CMake Warning (dev) at /path/to/Support/Qt/5.15.2/clang_64/lib/cmake/Qt5Core/Qt5CoreMacros.cmake:44 (message):
    qt5_get_moc_flags is not part of the official API, and might be removed in
    Qt 6.
  Call Stack (most recent call first):
    /path/to/Support/Qt/5.15.2/clang_64/lib/cmake/Qt5Core/Qt5CoreMacros.cmake:86 (_qt5_warn_deprecated)
    /path/to/Projects/S-r-v8/CTK/CMake/ctkMacroGenerateMocs.cmake:8 (QT5_GET_MOC_FLAGS)
    /path/to/Projects/S-r-v8/CTK/CMake/ctkMacroGenerateMocs.cmake:43 (QT4_GENERATE_MOCS)
    Modules/Loadable/VolumeRendering/Testing/Cxx/CMakeLists.txt:41 (QT5_GENERATE_MOCS)
  CMake Warning (dev) at /path/to/Support/Qt/5.15.2/clang_64/lib/cmake/Qt5Core/Qt5CoreMacros.cmake:44 (message):
    qt5_create_moc_command is not part of the official API, and might be
    removed in Qt 6.
  Call Stack (most recent call first):
    /path/to/Support/Qt/5.15.2/clang_64/lib/cmake/Qt5Core/Qt5CoreMacros.cmake:120 (_qt5_warn_deprecated)
    /path/to/Projects/S-r-v8/CTK/CMake/ctkMacroGenerateMocs.cmake:32 (QT5_CREATE_MOC_COMMAND)
    /path/to/Projects/S-r-v8/CTK/CMake/ctkMacroGenerateMocs.cmake:43 (QT4_GENERATE_MOCS)
    Modules/Loadable/VolumeRendering/Testing/Cxx/CMakeLists.txt:41 (QT5_GENERATE_MOCS)
  This warning is for project developers.  Use -Wno-dev to suppress it.

@jcfr jcfr requested a review from lassoan November 4, 2021 16:06
Copy link
Member

@lassoan lassoan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just added two nitpicks.

CMake/ctkMacroGenerateMocs.cmake Show resolved Hide resolved
CMake/ctkMacroGenerateMocs.cmake Outdated Show resolved Hide resolved
…warnings

This commit updates ctkMacroGenerateMocs to internally use
qt5_generate_moc and fix deprecation warnings reported when
building against Qt >= 5.15.0

See https://doc.qt.io/qt-5/qtcore-cmake-qt5-generate-moc.html
and https://doc.qt.io/qt-5/cmake-command-reference.html#qt5-core

Example of warnings:

  CMake Warning (dev) at /path/to/Support/Qt/5.15.2/clang_64/lib/cmake/Qt5Core/Qt5CoreMacros.cmake:44 (message):
    qt5_get_moc_flags is not part of the official API, and might be removed in
    Qt 6.
  Call Stack (most recent call first):
    /path/to/Support/Qt/5.15.2/clang_64/lib/cmake/Qt5Core/Qt5CoreMacros.cmake:86 (_qt5_warn_deprecated)
    /path/to/Projects/S-r/CTK/CMake/ctkMacroGenerateMocs.cmake:8 (QT5_GET_MOC_FLAGS)
    /path/to/Projects/S-r/CTK/CMake/ctkMacroGenerateMocs.cmake:43 (QT4_GENERATE_MOCS)
    Modules/Loadable/VolumeRendering/Testing/Cxx/CMakeLists.txt:41 (QT5_GENERATE_MOCS)

  CMake Warning (dev) at /path/to/Support/Qt/5.15.2/clang_64/lib/cmake/Qt5Core/Qt5CoreMacros.cmake:44 (message):
    qt5_create_moc_command is not part of the official API, and might be
    removed in Qt 6.
  Call Stack (most recent call first):
    /path/to/Support/Qt/5.15.2/clang_64/lib/cmake/Qt5Core/Qt5CoreMacros.cmake:120 (_qt5_warn_deprecated)
    /path/to/Projects/S-r/CTK/CMake/ctkMacroGenerateMocs.cmake:32 (QT5_CREATE_MOC_COMMAND)
    /path/to/Projects/S-r/CTK/CMake/ctkMacroGenerateMocs.cmake:43 (QT4_GENERATE_MOCS)
    Modules/Loadable/VolumeRendering/Testing/Cxx/CMakeLists.txt:41 (QT5_GENERATE_MOCS)
  This warning is for project developers.  Use -Wno-dev to suppress it.

Co-authored-by: Andras Lasso <[email protected]>
@jcfr jcfr force-pushed the fix-qt5-warnings-in-ctkMacroGenerateMocs branch from a02a829 to 78d7343 Compare November 5, 2021 05:47
@jcfr jcfr mentioned this pull request Nov 5, 2021
1 task
@jcfr jcfr merged commit 03575a0 into commontk:master Nov 5, 2021
@jcfr jcfr deleted the fix-qt5-warnings-in-ctkMacroGenerateMocs branch November 5, 2021 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants