CMakePM: auto-setup.cmake do not fail if QtCreator.ini doesn't exist

There are Qt Creator installations that do not provide
"QtProject/QtCreator.ini" file, and without it the auto-setup.cmake
code would fail.

Task-number: QTBUG-99273
Change-Id: I7674f68bc89375d8065d820b89650a358a7226b2
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Cristian Adam
2022-01-25 15:33:00 +01:00
parent 4fc883d491
commit 795d7364df

View File

@@ -33,18 +33,20 @@ macro(qtc_auto_setup_conan)
# Get conan from Qt SDK # Get conan from Qt SDK
set(qt_creator_ini "${CMAKE_CURRENT_LIST_DIR}/../QtProject/QtCreator.ini") set(qt_creator_ini "${CMAKE_CURRENT_LIST_DIR}/../QtProject/QtCreator.ini")
file(STRINGS ${qt_creator_ini} install_settings REGEX "^InstallSettings=.*$") if (EXISTS ${qt_creator_ini})
if (install_settings) file(STRINGS ${qt_creator_ini} install_settings REGEX "^InstallSettings=.*$")
string(REPLACE "InstallSettings=" "" install_settings "${install_settings}") if (install_settings)
set(qt_creator_ini "${install_settings}/QtProject/QtCreator.ini") string(REPLACE "InstallSettings=" "" install_settings "${install_settings}")
file(TO_CMAKE_PATH "${qt_creator_ini}" qt_creator_ini) set(qt_creator_ini "${install_settings}/QtProject/QtCreator.ini")
endif() file(TO_CMAKE_PATH "${qt_creator_ini}" qt_creator_ini)
endif()
file(STRINGS ${qt_creator_ini} conan_executable REGEX "^ConanFilePath=.*$") file(STRINGS ${qt_creator_ini} conan_executable REGEX "^ConanFilePath=.*$")
if (conan_executable) if (conan_executable)
string(REPLACE "ConanFilePath=" "" conan_executable "${conan_executable}") string(REPLACE "ConanFilePath=" "" conan_executable "${conan_executable}")
file(TO_CMAKE_PATH "${conan_executable}" conan_executable) file(TO_CMAKE_PATH "${conan_executable}" conan_executable)
get_filename_component(conan_path "${conan_executable}" DIRECTORY) get_filename_component(conan_path "${conan_executable}" DIRECTORY)
endif()
endif() endif()
set(path_sepparator ":") set(path_sepparator ":")