Changeset View
Changeset View
Standalone View
Standalone View
modules/ECMQueryQmake.cmake
| 1 | find_package(Qt5Core QUIET) | 1 | find_package(Qt5Core QUIET) | ||
|---|---|---|---|---|---|
| 2 | 2 | | |||
| 3 | if (Qt5Core_FOUND) | | |||
| 4 | set(_qmake_executable_default "qmake-qt5") | | |||
| 5 | endif () | | |||
| 6 | if (TARGET Qt5::qmake) | 3 | if (TARGET Qt5::qmake) | ||
| 7 | get_target_property(_qmake_executable_default Qt5::qmake LOCATION) | 4 | get_target_property(_qmake_executable_default Qt5::qmake LOCATION) | ||
| 5 | else() | ||||
| 6 | # If the project() line contains the 'NONE' keyword, the find_package call | ||||
kossebau: Perhaps worth to add a comment describing all known scenarios why we reach the else branch.
The… | |||||
| 7 | # above will not be able to find Qt5Core. | ||||
| 8 | # We need to look for the executable directly. | ||||
| 9 | find_program(_qmake_executable_default NAMES qmake-qt5 qmake) | ||||
^ on FreeBSD qmake-qt5 is just called qmake (which is in fact qtchooser). tcberner: ^ on FreeBSD qmake-qt5 is just called qmake (which is in fact qtchooser). | |||||
| 8 | endif() | 10 | endif() | ||
| 11 | | ||||
| 9 | set(QMAKE_EXECUTABLE ${_qmake_executable_default} | 12 | set(QMAKE_EXECUTABLE ${_qmake_executable_default} | ||
| 10 | CACHE FILEPATH "Location of the Qt5 qmake executable") | 13 | CACHE FILEPATH "Location of the Qt5 qmake executable") | ||
| 11 | 14 | | |||
| 12 | # Helper method | 15 | # Helper method | ||
| 13 | # This is not public API (yet)! | 16 | # This is not public API (yet)! | ||
| 14 | # Usage: query_qmake(<result_variable> <qt_variable> [TRY]) | 17 | # Usage: query_qmake(<result_variable> <qt_variable> [TRY]) | ||
| 15 | # Passing TRY will result in the method not failing fatal if no qmake executable | 18 | # Passing TRY will result in the method not failing fatal if no qmake executable | ||
| 16 | # has been found, but instead simply returning an empty string | 19 | # has been found, but instead simply returning an empty string | ||
| Show All 30 Lines | |||||
Perhaps worth to add a comment describing all known scenarios why we reach the else branch.
The version with find_package(Qt5Core) failing due to NONE language would be not on my radar, thus nice to have it listed here for future code readers.