[Interest] How to use Qt6::qmake ?

Nicholas Yue yue.nicholas at gmail.com
Tue Jan 19 04:13:08 CET 2021


Thanks Marius for gist, I am afraid it is unlikely to work out for me as it
still refers to QT_QMAKE_TARGET which is set to Qt6::qmake

In the cmake files ship with *Qt5* I see this (in Qt5CoreConfigExtras.cmake)

if (NOT TARGET Qt5::qmake)
    add_executable(Qt5::qmake IMPORTED)

    set(imported_location "${_qt5Core_install_prefix}/bin/qmake")
    _qt5_Core_check_file_exists(${imported_location})

    set_target_properties(Qt5::qmake PROPERTIES
        IMPORTED_LOCATION ${imported_location}
    )
endif()

In the cmake files ship with *Qt6* I see this
(in Qt6CoreToolsAdditionalTargetInfo.cmake)

# Default configuration


if(_qt_imported_location_default)
    set_property(TARGET Qt6::qmake PROPERTY IMPORTED_LOCATION
"${_qt_imported_location_default}")
endif()

For the Qt5 cmake configuration, the setting of the path to the actual
qmake binary whereas in the Qt6 variant, is looks like a generic import
location not tied to qmake specifically. I am wondering if that is the
reason why trying to use Qt6::qmake results it not working because it was
not setup to an actual binary file location.

Cheers

On Mon, 18 Jan 2021 at 15:24, Marius Kittler <mkittler at suse.de> wrote:

> Hi,
>
> Qt's CMake modules should already make most paths available. I came up
> with
> the following approach to support Qt 5 and Qt 6:
> https://github.com/Martchus/
> qtutilities/blob/5960c215586cf0ca777a511c6f0830c1c63ddaa8/cmake/modules/
> QtLinkage.cmake#L124
> <https://github.com/Martchus/qtutilities/blob/5960c215586cf0ca777a511c6f0830c1c63ddaa8/cmake/modules/QtLinkage.cmake#L124>
>
> It works at least for QT_INSTALL_TRANSLATIONS. Maybe it needed to be
> tweaked
> for other variables.
>
> This function also shows how to get the location of the qmake binary if
> you
> really need it after all.
>
> I'd also suggest to use the CMake modules Qt provides for using Linguist.
> This
> has already worked with Qt 5 and continues to work with Qt 6. When cross-
> compiling you currently need a workaround, though: https://github.com/
> Martchus/qtutilities/blob/5960c215586cf0ca777a511c6f0830c1c63ddaa8/cmake/
> modules/QtConfig.cmake#L303
> <https://github.com/Martchus/qtutilities/blob/5960c215586cf0ca777a511c6f0830c1c63ddaa8/cmake/modules/QtConfig.cmake#L303>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
>


-- 
Nicholas Yue
Graphics - Arnold, Alembic, RenderMan, OpenGL, HDF5
Custom Dev - C++ porting, OSX, Linux, Windows
http://au.linkedin.com/in/nicholasyue
https://vimeo.com/channels/naiadtools
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20210118/5a124766/attachment.html>


More information about the Interest mailing list