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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions CMake/ctkMacroGenerateMocs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@

include(MacroAddFileDependencies)

function(QT4_GENERATE_MOCS)
function(_ctk_generate_mocs)
if(CTK_QT_VERSION VERSION_GREATER "4")
QT5_GET_MOC_FLAGS(_moc_flags)
if(Qt5_VERSION VERSION_LESS "5.15.0")
QT5_GET_MOC_FLAGS(_moc_flags)
jcfr marked this conversation as resolved.
Show resolved Hide resolved
else()
# _moc_flags is not needed because it is internally handled
# by qt5_generate_moc called below.
endif()
else()
QT4_GET_MOC_FLAGS(_moc_flags)
endif()
Expand All @@ -28,8 +33,12 @@ function(QT4_GENERATE_MOCS)
if(CTK_QT_VERSION VERSION_GREATER "4")
if(Qt5_VERSION VERSION_LESS "5.6")
QT5_CREATE_MOC_COMMAND(${abs_file} ${moc_file} "${_moc_flags}" "" "")
else()
elseif(Qt5_VERSION VERSION_LESS "5.15.0")
QT5_CREATE_MOC_COMMAND(${abs_file} ${moc_file} "${_moc_flags}" "" "" "")
else()
# qt5_generate_moc internally calls qt5_get_moc_flags and ensure
# no warnings are reported.
qt5_generate_moc(${abs_file} ${moc_file})
jcfr marked this conversation as resolved.
Show resolved Hide resolved
endif()
else()
QT4_CREATE_MOC_COMMAND(${abs_file} ${moc_file} "${_moc_flags}" "" "")
Expand All @@ -38,7 +47,12 @@ function(QT4_GENERATE_MOCS)
endforeach()
endfunction()

# create a Qt4 alias
macro(QT4_GENERATE_MOCS)
_ctk_generate_mocs(${ARGN})
endmacro()

# create a Qt5 alias
macro(QT5_GENERATE_MOCS)
QT4_GENERATE_MOCS(${ARGN})
_ctk_generate_mocs(${ARGN})
endmacro()