[Debian-med-packaging] Help with cmake / Qt5 migration needed

Alexis Murzeau amubtdx at outlook.fr
Thu Oct 19 18:33:59 UTC 2017


Hi,

Le 19/10/2017 18:56, Andreas Tille a écrit :
> Hi Andrey,
>
> On Thu, Oct 19, 2017 at 07:16:47PM +0500, Andrey Rahmatullin wrote:
>> On Thu, Oct 19, 2017 at 04:11:49PM +0200, Andreas Tille wrote:
>>> The FIND_PACKAGE line was patched by me where I naively did
>>>
>>>    s/Qt4 REQUIRED/Qt5 REQUIRED/
>> find_package(Qt5 REQUIRED COMPONENTS Core Widgets)
>> or something.
>> This doesn't guarantee that the code will compile, of course.
>
> This helped me a but further I was also able to fix some more issues.
>
> Now I'm struck by
>
> CMake Error at src/qtbeads/CMakeLists.txt:83 (QT5_ADD_TRANSLATION):
>   Unknown CMake command "QT5_ADD_TRANSLATION".
>
>
> here also my naive s/QT4_ADD_TRANSLATION/QT5_ADD_TRANSLATION/
> did not worked an my web search was not successful. :-(

I have migrated from Qt4 to Qt5 with CMake and found my way with [1] and
[2]:
----
find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets LinguistTools)

# Use the ones you need
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

# LinguistTools is needed in find_package to make this macro available
qt5_create_translation(QM_FILES ${SRC_FILES} ${HEADER_FILES} ${UI_FILES}
${TS_FILES})

add_executable(PROGRAM ${SRC_FILES} ${HEADER_FILES} ${QM_FILES}
${QRC_FILES} ${UI_FILES})
target_link_libraries(PROGRAM Qt5::Core Qt5::Widgets Qt5::Gui)
-----

AUTOMOC inspect cpp source files to find Q_OBJECT or Q_GADGET.
AUTOUIC inspect cpp source files for #include of "ui_*.h" and the
existence of a .ui file to run uic on them.
AUTORCC run rcc on *.qrc sources files

[1] https://cmake.org/cmake/help/v3.0/manual/cmake-qt.7.html
[2] http://doc.qt.io/qt-5/cmake-manual.html

-- 
Alexis Murzeau
PGP: B7E6 0EBB 9293 7B06 BDBC  2787 E7BD 1904 F480 937F

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/debian-med-packaging/attachments/20171019/5b8c0dda/attachment.sig>


More information about the Debian-med-packaging mailing list