[Interest] How to use Qt6::qmake ?

Joerg Bornemann joerg.bornemann at qt.io
Wed Feb 3 10:38:02 CET 2021


On 1/19/21 5:40 PM, Thiago Macieira wrote:

> On Monday, 18 January 2021 19:13:08 PST Nicholas Yue wrote:
>> 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.
> 
> Please report the issue.
> 
> Because of Qt 6's switch to using CMake, there are a number of compatibility
> issues with the generated .cmake files (as well as files for qmake and
> possibly pkg-config) that weren't noticed during testing.

In this case, howeever, there's no bug. Copying my answer from 
QTBUG-90458 here as well:

execute_process does not take a target, unlike add_custom_target what 
Kai already suggested. I double-checked that Qt6::qmake is set up 
correctly, and the following working snippet proves its correctness:

---snip---
find_package(Qt6 COMPONENTS Core REQUIRED)
get_target_property(qmake_location Qt6::qmake LOCATION)
message("------ qmake location: ${qmake_location}")
message("------ calling qmake")
execute_process(COMMAND "${qmake_location}" -query
     RESULT_VARIABLE exit_code
     )
message("------ qmake returned with exit code '${exit_code}'")
---snap---


Cheers,

Joerg


More information about the Interest mailing list