As a user of a CMake I might have 3rd party packages that would be found by find_package.
CMake expects those packages to exist, with the use of a package manager they can be made available.
Such a package manager could be conan, vcpkg or cpp-pm, but also a system package manager like apt, pkgcon or choco.
Since CMake version 3.15 CMake provides the ability to inject a CMake script via CMAKE_PROJECT_INCLUDE_BEFORE variable.
In such a script one could make sure that if conanfile.txt is present than conan install would be called, same for vcpkg.json with vcpkg install.
The use case would be a Hello World application that uses fmt to print a message:
And the CMakeLists.txt code for it:
A conanfile.txt would look like this:
A vcpkg.json would looke like this:
As a user I expect a project to load, compile successfully when the right setup with CMAKE_PROJECT_INCLUDE_BEFORE is setup.
The custom script would be able to:
- load QtCreatorPackageManager.cmake script found in the source directory
- QT_CREATOR_SKIP_PACKAGE_MANAGER_SETUP would skip the whole auto-setup
- QT_CREATOR_SKIP_CONAN_SETUP would skip the conan auto-setup
- QT_CREATOR_SKIP_VCPKG_SETUP would skip the vcpkg auto-setup