[Qt-creator] No more "Link with Qt..." step for own Qt Creator builds

Cristian Adam cristian.adam at qt.io
Fri Sep 10 17:47:40 CEST 2021


Hi,

While building Qt Creator have you encountered the situation when your 
Kits and Qt versions would disappear?

The fix would be to click /"Link with Qt..."/ in Options -> Kits -> Qt 
Versions.

There is another way, when building Qt Creator from Qt Creator, the 
built Qt Creator could inherit the QtCreator.ini automatically when the 
following code is placed in the Qt Creator's repository as PreLoad.cmake 
or QtCreatorPackageManager.cmake file:

# When building with Qt Creator 4.15+ do the "Link with Qt..." automatically
*if*  (DEFINED  CMAKE_PROJECT_INCLUDE_BEFORE)
     *get_filename_component*(auto_setup_dir"${CMAKE_PROJECT_INCLUDE_BEFORE}"  DIRECTORY)
     *set*(qt_creator_ini"${auto_setup_dir}/../QtProject/QtCreator.ini")
     *if*  (EXISTS  "${qt_creator_ini}")
         *file*(STRINGS  "${qt_creator_ini}"  install_settingsREGEX  "^InstallSettings=.*$")
         *if*  (install_settings)
             *string*(REPLACE  "InstallSettings="  ""  install_settings"${install_settings}")
         *else*()
             *file*(TO_CMAKE_PATH  "${auto_setup_dir}/.."  install_settings)
         *endif*()
         *file*(WRITE  ${CMAKE_BINARY_DIR}/share/qtcreator/QtProject/QtCreator.ini
                    "[Settings]\nInstallSettings=${install_settings}")
     *endif*()
*endif*()

Cheers,
Cristian.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20210910/1d933f05/attachment.html>


More information about the Qt-creator mailing list