diff options
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/ECMQueryQt.cmake | 49 | 
1 files changed, 25 insertions, 24 deletions
diff --git a/modules/ECMQueryQt.cmake b/modules/ECMQueryQt.cmake index 4f40ace7..98eb5008 100644 --- a/modules/ECMQueryQt.cmake +++ b/modules/ECMQueryQt.cmake @@ -36,35 +36,36 @@ Since: 5.93  #]=======================================================================]  include(${CMAKE_CURRENT_LIST_DIR}/QtVersionOption.cmake) +include(CheckLanguage) +check_language(CXX) +if (CMAKE_CXX_COMPILER) +    # Enable the CXX language to let CMake look for config files in library dirs. +    # See: https://gitlab.kitware.com/cmake/cmake/-/issues/23266 +    enable_language(CXX) +endif()  if (QT_MAJOR_VERSION STREQUAL "5") -    find_program(_qmake_executable_default NAMES qmake qmake-qt5 qmake5) -    if(NOT _qmake_executable_default) -        # Enable the CXX language to let CMake look for config files -        # into library dirs -        enable_language(CXX) -        find_package(Qt${QT_MAJOR_VERSION}Core QUIET) -        if(TARGET Qt5::qmake) -            get_target_property(_qmake_executable_default Qt5::qmake LOCATION) -        endif() +    # QUIET to accommodate the TRY option +    find_package(Qt${QT_MAJOR_VERSION}Core QUIET) +    if(TARGET Qt5::qmake) +        get_target_property(_qmake_executable_default Qt5::qmake LOCATION) + +        set(QUERY_EXECUTABLE ${_qmake_executable_default} +            CACHE FILEPATH "Location of the Qt5 qmake executable") +        set(_exec_name_text "Qt5 qmake") +        set(_cli_option "-query")      endif() -    set(QUERY_EXECUTABLE ${_qmake_executable_default} -        CACHE FILEPATH "Location of the Qt5 qmake executable") -    set(_exec_name_text "Qt5 qmake") -    set(_cli_option "-query")  elseif(QT_MAJOR_VERSION STREQUAL "6") -    find_program(_qtpaths_executable NAMES qtpaths6) -    if(NOT _qtpaths_executable) -        enable_language(CXX) -        find_package(Qt6 COMPONENTS CoreTools QUIET CONFIG) -        if (TARGET Qt6::qtpaths) -            get_target_property(_qtpaths_executable Qt6::qtpaths LOCATION) -        endif() +    # QUIET to accommodate the TRY option +    find_package(Qt6 COMPONENTS CoreTools QUIET CONFIG) +    if (TARGET Qt6::qtpaths) +        get_target_property(_qtpaths_executable Qt6::qtpaths LOCATION) + +        set(QUERY_EXECUTABLE ${_qtpaths_executable} +            CACHE FILEPATH "Location of the Qt6 qtpaths executable") +        set(_exec_name_text "Qt6 qtpaths") +        set(_cli_option "--query")      endif() -    set(QUERY_EXECUTABLE ${_qtpaths_executable} -        CACHE FILEPATH "Location of the Qt6 qtpaths executable") -    set(_exec_name_text "Qt6 qtpaths") -    set(_cli_option "--query")  endif()  function(ecm_query_qt result_variable qt_variable)  | 
