diff --git a/src/share/3rdparty/package-manager/auto-setup.cmake b/src/share/3rdparty/package-manager/auto-setup.cmake index e1f1dcb2663..ff57ac8d0eb 100644 --- a/src/share/3rdparty/package-manager/auto-setup.cmake +++ b/src/share/3rdparty/package-manager/auto-setup.cmake @@ -31,32 +31,6 @@ macro(qtc_auto_setup_conan) option(QT_CREATOR_SKIP_CONAN_SETUP "Skip Qt Creator's conan package manager auto-setup" OFF) set(QT_CREATOR_CONAN_BUILD_POLICY "missing" CACHE STRING "Qt Creator's conan package manager auto-setup build policy. This is used for the BUILD property of cmake_conan_run") - # Get conan from Qt SDK - set(qt_creator_ini "${CMAKE_CURRENT_LIST_DIR}/../QtProject/QtCreator.ini") - if (EXISTS ${qt_creator_ini}) - file(STRINGS ${qt_creator_ini} install_settings REGEX "^InstallSettings=.*$") - if (install_settings) - string(REPLACE "InstallSettings=" "" install_settings "${install_settings}") - set(qt_creator_ini "${install_settings}/QtProject/QtCreator.ini") - file(TO_CMAKE_PATH "${qt_creator_ini}" qt_creator_ini) - endif() - - file(STRINGS ${qt_creator_ini} conan_executable REGEX "^ConanFilePath=.*$") - if (conan_executable) - string(REPLACE "ConanFilePath=" "" conan_executable "${conan_executable}") - file(TO_CMAKE_PATH "${conan_executable}" conan_executable) - get_filename_component(conan_path "${conan_executable}" DIRECTORY) - endif() - endif() - - set(path_sepparator ":") - if (WIN32) - set(path_sepparator ";") - endif() - if (conan_path) - set(ENV{PATH} "${conan_path}${path_sepparator}$ENV{PATH}") - endif() - find_program(conan_program conan) if (NOT conan_program) message(WARNING "Qt Creator: conan executable not found. " @@ -64,6 +38,13 @@ macro(qtc_auto_setup_conan) "To disable this warning set QT_CREATOR_SKIP_CONAN_SETUP to ON.") return() endif() + execute_process(COMMAND ${conan_program} --version + RESULT_VARIABLE result_code + OUTPUT_VARIABLE conan_version_output + ERROR_VARIABLE conan_version_output) + if (NOT result_code EQUAL 0) + message(FATAL_ERROR "conan --version failed='${result_code}: ${conan_version_output}") + endif() set(conanfile_timestamp_file "${CMAKE_BINARY_DIR}/conan-dependencies/conanfile.timestamp") file(TIMESTAMP "${conanfile_txt}" conanfile_timestamp) @@ -147,7 +128,17 @@ macro(qtc_auto_setup_vcpkg) "To disable this warning set QT_CREATOR_SKIP_VCPKG_SETUP to ON.") return() endif() - get_filename_component(vpkg_root ${vcpkg_program} DIRECTORY) + execute_process(COMMAND ${vcpkg_program} version + RESULT_VARIABLE result_code + OUTPUT_VARIABLE vcpkg_version_output + ERROR_VARIABLE vcpkg_version_output) + if (NOT result_code EQUAL 0) + message(FATAL_ERROR "vcpkg version failed='${result_code}: ${vcpkg_version_output}") + endif() + + # Resolve any symlinks + get_filename_component(vpkg_program_real_path ${vcpkg_program} REALPATH) + get_filename_component(vpkg_root ${vpkg_program_real_path} DIRECTORY) if (NOT EXISTS "${CMAKE_BINARY_DIR}/vcpkg-dependencies/toolchain.cmake") message(STATUS "Qt Creator: vcpkg package manager auto-setup. " @@ -168,8 +159,8 @@ macro(qtc_auto_setup_vcpkg) else() if (WIN32) set(vcpkg_triplet x64-mingw-static) - if (CMAKE_CXX_COMPILER MATCHES "cl.exe") - set(vcpkg_triplet x64-windows) + if (CMAKE_CXX_COMPILER MATCHES ".*/(.*)/cl.exe") + set(vcpkg_triplet ${CMAKE_MATCH_1}-windows) endif() elseif(APPLE) set(vcpkg_triplet x64-osx)