Details
-
Task
-
Resolution: Done
-
Not Evaluated
-
None
-
None
-
cc0fa86ffd6c202aeb7ee091bbf8a91d7623718c (qt-creator/qt-creator/master)
Description
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:
#include <fmt/core.h> int main() { fmt::print("Привет мир\n"); return 0; }
And the CMakeLists.txt code for it:
cmake_minimum_required(VERSION 3.15) project(hello-world LANGUAGES CXX) add_executable(hello-world main.cpp) find_package(fmt REQUIRED) target_link_libraries(hello-world PRIVATE fmt::fmt)
A conanfile.txt would look like this:
[requires] fmt/7.1.3 [generators] cmake_find_package
A vcpkg.json would looke like this:
{ "name": "hello-world", "version-string": "0.0.1", "dependencies": [ "fmt" ] }
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
Attachments
Issue Links
- is required for
-
QTCREATORBUG-25353 Conan: Use environment specified by json generator in following build/run steps
- Open