Help needed using conan package manager inside QtCreator15.0.0
-
As you can see in the picture... it just works 😅
-
As you can see in the picture... it just works 😅
@cristian-adam Hm strange i bet im doing something wrong. Would it be possible to provide your project via github or something with step by step instructions on what commands you use?
Would really appreciate that, cause having to do this all over and over again manually really sucks. :D
-
@cristian-adam Hm strange i bet im doing something wrong. Would it be possible to provide your project via github or something with step by step instructions on what commands you use?
Would really appreciate that, cause having to do this all over and over again manually really sucks. :D
@StudentScripter https://github.com/qt-creator/qt-creator/tree/master/tests/manual/cmakeprojectmanager/conan
I just changed the content of the
conanfile.txt
as you can see above in the picture. -
@StudentScripter https://github.com/qt-creator/qt-creator/tree/master/tests/manual/cmakeprojectmanager/conan
I just changed the content of the
conanfile.txt
as you can see above in the picture.@cristian-adam Well i've exactly copied all your files:
But still i get these errors:
Cannot update Qt version information from C:\Qt\6.8.0\mingw_64\bin\qmake.exe: qmake "C:\Qt\6.8.0\mingw_64\bin\qmake.exe" is not an executable.. Cannot update Qt version information from C:\Users\Musik\Documents\Qt\6.8.0\msvc2022_arm64\bin\qmake.exe: Timeout running "C:\Users\Musik\Documents\Qt\6.8.0\msvc2022_arm64\bin\qmake.exe".. [cmake] Running C:\Program Files\CMake\bin\cmake.exe -S C:/Users/Musik/Desktop/conan -B C:/Users/Musik/Desktop/conan/build/Desktop_Qt_6_9_0_llvm_mingw_64_bit-Debug "-DQT_QML_GENERATE_QMLLS_INI:BOOL=ON" "-DCMAKE_PREFIX_PATH:PATH=C:/Users/Musik/Documents/Qt/6.9.0/llvm-mingw_64" "-DCMAKE_CXX_COMPILER:FILEPATH=C:/Users/Musik/Documents/Qt/Tools/llvm-mingw1706_64/bin/clang++.exe" "-DCMAKE_GENERATOR:STRING=Ninja" "-DCMAKE_C_COMPILER:FILEPATH=C:/Users/Musik/Documents/Qt/Tools/llvm-mingw1706_64/bin/clang.exe" "-DCMAKE_BUILD_TYPE:STRING=Debug" "-DQT_QMAKE_EXECUTABLE:FILEPATH=C:/Users/Musik/Documents/Qt/6.9.0/llvm-mingw_64/bin/qmake.exe" "-DCMAKE_COLOR_DIAGNOSTICS:BOOL=ON" "-DCMAKE_CXX_FLAGS_INIT:STRING=-DQT_QML_DEBUG" in C:\Users\Musik\Desktop\conan\build\Desktop_Qt_6_9_0_llvm_mingw_64_bit-Debug. [cmake] -- The C compiler identification is Clang 17.0.6 [cmake] -- The CXX compiler identification is Clang 17.0.6 [cmake] -- Detecting C compiler ABI info [cmake] -- Detecting C compiler ABI info - done [cmake] -- Check for working C compiler: C:/Users/Musik/Documents/Qt/Tools/llvm-mingw1706_64/bin/clang.exe - skipped [cmake] -- Detecting C compile features [cmake] -- Detecting C compile features - done [cmake] -- Detecting CXX compiler ABI info [cmake] -- Detecting CXX compiler ABI info - done [cmake] -- Check for working CXX compiler: C:/Users/Musik/Documents/Qt/Tools/llvm-mingw1706_64/bin/clang++.exe - skipped [cmake] -- Detecting CXX compile features [cmake] -- Detecting CXX compile features - done [cmake] CMake Error at CMakeLists.txt:6 (find_package): [cmake] By not providing "Findfmt.cmake" in CMAKE_MODULE_PATH this project has [cmake] asked CMake to find a package configuration file provided by "fmt", but [cmake] CMake did not find one. [cmake] [cmake] Could not find a package configuration file provided by "fmt" with any of [cmake] the following names: [cmake] [cmake] fmtConfig.cmake [cmake] fmt-config.cmake [cmake] [cmake] Add the installation prefix of "fmt" to CMAKE_PREFIX_PATH or set "fmt_DIR" [cmake] to a directory containing one of the above files. If "fmt" provides a [cmake] separate development package or SDK, be sure it has been installed. [cmake] [cmake] [cmake] -- Configuring incomplete, errors occurred! [cmake] [cmake] The command "C:\Program Files\CMake\bin\cmake.exe -S C:/Users/Musik/Desktop/conan -B C:/Users/Musik/Desktop/conan/build/Desktop_Qt_6_9_0_llvm_mingw_64_bit-Debug "-DQT_QML_GENERATE_QMLLS_INI:BOOL=ON" "-DCMAKE_PREFIX_PATH:PATH=C:/Users/Musik/Documents/Qt/6.9.0/llvm-mingw_64" "-DCMAKE_CXX_COMPILER:FILEPATH=C:/Users/Musik/Documents/Qt/Tools/llvm-mingw1706_64/bin/clang++.exe" "-DCMAKE_GENERATOR:STRING=Ninja" "-DCMAKE_C_COMPILER:FILEPATH=C:/Users/Musik/Documents/Qt/Tools/llvm-mingw1706_64/bin/clang.exe" "-DCMAKE_BUILD_TYPE:STRING=Debug" "-DQT_QMAKE_EXECUTABLE:FILEPATH=C:/Users/Musik/Documents/Qt/6.9.0/llvm-mingw_64/bin/qmake.exe" "-DCMAKE_COLOR_DIAGNOSTICS:BOOL=ON" "-DCMAKE_CXX_FLAGS_INIT:STRING=-DQT_QML_DEBUG"" terminated with exit code 1. [cmake] [cmake] Elapsed time: 00:02.
-
@cristian-adam Well i've exactly copied all your files:
But still i get these errors:
Cannot update Qt version information from C:\Qt\6.8.0\mingw_64\bin\qmake.exe: qmake "C:\Qt\6.8.0\mingw_64\bin\qmake.exe" is not an executable.. Cannot update Qt version information from C:\Users\Musik\Documents\Qt\6.8.0\msvc2022_arm64\bin\qmake.exe: Timeout running "C:\Users\Musik\Documents\Qt\6.8.0\msvc2022_arm64\bin\qmake.exe".. [cmake] Running C:\Program Files\CMake\bin\cmake.exe -S C:/Users/Musik/Desktop/conan -B C:/Users/Musik/Desktop/conan/build/Desktop_Qt_6_9_0_llvm_mingw_64_bit-Debug "-DQT_QML_GENERATE_QMLLS_INI:BOOL=ON" "-DCMAKE_PREFIX_PATH:PATH=C:/Users/Musik/Documents/Qt/6.9.0/llvm-mingw_64" "-DCMAKE_CXX_COMPILER:FILEPATH=C:/Users/Musik/Documents/Qt/Tools/llvm-mingw1706_64/bin/clang++.exe" "-DCMAKE_GENERATOR:STRING=Ninja" "-DCMAKE_C_COMPILER:FILEPATH=C:/Users/Musik/Documents/Qt/Tools/llvm-mingw1706_64/bin/clang.exe" "-DCMAKE_BUILD_TYPE:STRING=Debug" "-DQT_QMAKE_EXECUTABLE:FILEPATH=C:/Users/Musik/Documents/Qt/6.9.0/llvm-mingw_64/bin/qmake.exe" "-DCMAKE_COLOR_DIAGNOSTICS:BOOL=ON" "-DCMAKE_CXX_FLAGS_INIT:STRING=-DQT_QML_DEBUG" in C:\Users\Musik\Desktop\conan\build\Desktop_Qt_6_9_0_llvm_mingw_64_bit-Debug. [cmake] -- The C compiler identification is Clang 17.0.6 [cmake] -- The CXX compiler identification is Clang 17.0.6 [cmake] -- Detecting C compiler ABI info [cmake] -- Detecting C compiler ABI info - done [cmake] -- Check for working C compiler: C:/Users/Musik/Documents/Qt/Tools/llvm-mingw1706_64/bin/clang.exe - skipped [cmake] -- Detecting C compile features [cmake] -- Detecting C compile features - done [cmake] -- Detecting CXX compiler ABI info [cmake] -- Detecting CXX compiler ABI info - done [cmake] -- Check for working CXX compiler: C:/Users/Musik/Documents/Qt/Tools/llvm-mingw1706_64/bin/clang++.exe - skipped [cmake] -- Detecting CXX compile features [cmake] -- Detecting CXX compile features - done [cmake] CMake Error at CMakeLists.txt:6 (find_package): [cmake] By not providing "Findfmt.cmake" in CMAKE_MODULE_PATH this project has [cmake] asked CMake to find a package configuration file provided by "fmt", but [cmake] CMake did not find one. [cmake] [cmake] Could not find a package configuration file provided by "fmt" with any of [cmake] the following names: [cmake] [cmake] fmtConfig.cmake [cmake] fmt-config.cmake [cmake] [cmake] Add the installation prefix of "fmt" to CMAKE_PREFIX_PATH or set "fmt_DIR" [cmake] to a directory containing one of the above files. If "fmt" provides a [cmake] separate development package or SDK, be sure it has been installed. [cmake] [cmake] [cmake] -- Configuring incomplete, errors occurred! [cmake] [cmake] The command "C:\Program Files\CMake\bin\cmake.exe -S C:/Users/Musik/Desktop/conan -B C:/Users/Musik/Desktop/conan/build/Desktop_Qt_6_9_0_llvm_mingw_64_bit-Debug "-DQT_QML_GENERATE_QMLLS_INI:BOOL=ON" "-DCMAKE_PREFIX_PATH:PATH=C:/Users/Musik/Documents/Qt/6.9.0/llvm-mingw_64" "-DCMAKE_CXX_COMPILER:FILEPATH=C:/Users/Musik/Documents/Qt/Tools/llvm-mingw1706_64/bin/clang++.exe" "-DCMAKE_GENERATOR:STRING=Ninja" "-DCMAKE_C_COMPILER:FILEPATH=C:/Users/Musik/Documents/Qt/Tools/llvm-mingw1706_64/bin/clang.exe" "-DCMAKE_BUILD_TYPE:STRING=Debug" "-DQT_QMAKE_EXECUTABLE:FILEPATH=C:/Users/Musik/Documents/Qt/6.9.0/llvm-mingw_64/bin/qmake.exe" "-DCMAKE_COLOR_DIAGNOSTICS:BOOL=ON" "-DCMAKE_CXX_FLAGS_INIT:STRING=-DQT_QML_DEBUG"" terminated with exit code 1. [cmake] [cmake] Elapsed time: 00:02.
@StudentScripter It looks like you don't have auto-setup configured. There is no
"-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=...
parameter to the CMake call.Thats the part where Qt Creator injects a piece of CMake code to the project, which does the part with
conan install
and setting up the paths forfind_package
to findlibfmt
. -
@StudentScripter It looks like you don't have auto-setup configured. There is no
"-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=...
parameter to the CMake call.Thats the part where Qt Creator injects a piece of CMake code to the project, which does the part with
conan install
and setting up the paths forfind_package
to findlibfmt
.@cristian-adam How to set that correcly and to what value should i probably set it?
ALSO big thanks for you affords so far!<3
-
@cristian-adam How to set that correcly and to what value should i probably set it?
ALSO big thanks for you affords so far!<3
@StudentScripter You don't need to set it manually.
The absence of it means that the Auto-Setup is disabled.
I've made a screencast for you below:
(Note that I have configured the project before, that's why
spdlog
was quickly found. But I've deleted thebuild
andCMakeLists.txt.user
file) -
@StudentScripter You don't need to set it manually.
The absence of it means that the Auto-Setup is disabled.
I've made a screencast for you below:
(Note that I have configured the project before, that's why
spdlog
was quickly found. But I've deleted thebuild
andCMakeLists.txt.user
file)@cristian-adam Thanks no everything is working. <3 Really appreciate that you took the time. I'll mark this post as solved for others who may come across this post. So my learnings are:
Solution/Learnings
-Conan 2.0 + Qt Creator
.
-
You don't need the conan plugin for Qt Creator --> as for now March 2025; QT Version 6.9, Creator Version 16.0.0
conanfile 2.0
support for .txt and .py is build in -
Enable
packagemanager auto setup
in the cmake settings of your qt creator project -
If everything works fine you don't have to enter any conan command manual
For anyone to copy and paste here the small demofiles for spdlog:
from conan import ConanFile from conan.tools.cmake import cmake_layout class ExampleRecipe(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "CMakeDeps", "CMakeToolchain" def requirements(self): self.requires("spdlog/1.15.1") def layout(self): cmake_layout(self)
main.cpp:
#include <iostream> #include <spdlog/spdlog.h> #include <spdlog/sinks/basic_file_sink.h> #include <spdlog/sinks/rotating_file_sink.h> #include <memory> int main() { try { // Einfacher Konsolen-Logger spdlog::info("Welcome to spdlog!"); spdlog::warn("This is a warning!"); spdlog::error("This is an error message!"); spdlog::debug("This debug message won't show unless you change the log level."); // Log-Level auf debug setzen spdlog::set_level(spdlog::level::debug); spdlog::debug("Now debug messages are visible!"); // Logger, der in eine Datei schreibt auto file_logger = spdlog::basic_logger_mt("file_logger", "logs/basic_log.txt"); file_logger->info("Logging to basic file."); file_logger->warn("Some warning in file log."); // Rotating file logger (max 5 MB pro Datei, max 3 Dateien) auto rotating_logger = spdlog::rotating_logger_mt("rot_logger", "logs/rotating_log.txt", 1048576 * 5, 3); rotating_logger->info("This is a rotating logger."); rotating_logger->error("Something went wrong in rotating logger."); // Log-Pattern ändern spdlog::set_pattern("[%Y-%m-%d %H:%M:%S.%e] %v [%l]"); spdlog::info("Using custom log pattern now."); // Flushing spdlog::flush_on(spdlog::level::info); } catch (const spdlog::spdlog_ex& ex) { std::cerr << "Log initialization failed: " << ex.what() << std::endl; return 1; } }
CMakeLists.cpp:
cmake_minimum_required(VERSION 3.24) set(CMAKE_CXX_STANDARD 20) project(spdlogexample) find_package(spdlog REQUIRED) add_executable(spdlogexample main.cpp) target_link_libraries(spdlogexample PRIVATE spdlog::spdlog) install(TARGETS spdlogexample)
-
-
-
-
@StudentScripter You don't need to set it manually.
The absence of it means that the Auto-Setup is disabled.
I've made a screencast for you below:
(Note that I have configured the project before, that's why
spdlog
was quickly found. But I've deleted thebuild
andCMakeLists.txt.user
file)This post is deleted! -
The error occurs because the auto-setup script created by QtCreator (build/.qtc/package-manager/conan_provider.cmake) cannot determine the current C++ standard. Take a look at the function
function(detect_host_profile output_file)
.The error is fixed by moving the C++ standard setting to the very beginning of your CMakeLists.txt script, before the project keyword.
For example, the correct CMakeLists.txt:
cmake_minimum_required(VERSION 3.16) # it is important that the standard be defined before the project keyword set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) project(i18n_strict LANGUAGES CXX)