Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CMake toolchain for integration with Conan using cmake-conan, cmake-conan-setup.

See original GitHub issue

Issue Description

Project Link


Dear Conan Team,

This project is my Solution to the issue that I posted before:

I’ve already writen down the Motivation, Usage, Mechanism, Demonstration…etc in this project. Please take a look. First of all, it is required for conan_cmake_install() supporting --conf argument in this project. See more details on this PR:

However, this PR is not yet merged to the master branch even the develop branch for now. So I have to prepare a modified version of conan.cmake in this project. Hope this PR can be merged as soon as possible. Otherwise, an error due to including conan_toolchain.cmake when using non-default CMake generators might occur. For example, using MSVC compilers with Ninja generator:

Click to expand
F:\GitRepo\cmake-conan-setup>vcvarsall x64
** Visual Studio 2019 Developer Command Prompt v16.11.19
** Copyright (c) 2021 Microsoft Corporation
[vcvarsall.bat] Environment initialized for: 'x64'

F:\GitRepo\cmake-conan-setup>cmake --preset win32-msvc-x64-ninja-debug
Preset CMake variables:


-- Downloading conan.cmake from
-- The C compiler identification is MSVC 19.29.30146.0
-- The CXX compiler identification is MSVC 19.29.30146.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped        
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: Detected VS runtime: MDd
-- Conan: checking conan executable
-- Conan: Found program C:/Python/Python310/Scripts/conan.exe
-- Conan: Version found Conan version 1.53.0
-- Conan executing: C:/Python/Python310/Scripts/conan.exe install F:/GitRepo/cmake-conan-setup/ --remote conancenter --install-folder F:/GitRepo/cmake-conan-setup/build/win32-msvc-x64-ninja-debug/conan-dependencies --output-folder F:/GitRepo/cmake-conan-setup/build/win32-msvc-x64-ninja-debug/conan-dependencies --build missing --settings arch=x86_64 --settings build_type=Debug --settings compiler=Visual Studio --settings compiler.version=16 --settings compiler.runtime=MDd  
compiler=Visual Studio
[env] Installing package
    cli11/2.2.0 from 'conancenter' - Cache
    eigen/3.3.9 from 'conancenter' - Cache
    fmt/8.1.1 from 'conancenter' - Cache
    cli11/2.2.0:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
    eigen/3.3.9:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
    fmt/8.1.1:8ed2451fe8e6a2dd1b2f8bac3c035717ff9ddfa8 - Cache

Installing (downloading, building) binaries...
cli11/2.2.0: Already installed!
eigen/3.3.9: Already installed!
fmt/8.1.1: Already installed! Generator txt created conanbuildinfo.txt WARN: Using the new toolchains and generators without specifying a build profile (e.g: -pr:b=default) is discouraged and might cause failures and unexpected behavior Generator 'CMakeToolchain' calling 'generate()' Preset 'default' added to CMakePresets.json. Invoke it manually using 'cmake --preset default' If your CMake version is not compatible with CMakePresets (<3.19) call cmake like: 'cmake <path> -G "Visual Studio 16 2019" -DCMAKE_TOOLCHAIN_FILE=F:\GitRepo\cmake-conan-setup\build\win32-msvc-x64-ninja-debug\conan-dependencies\conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW' WARN: Using the new toolchains and generators without specifying a build profile (e.g: -pr:b=default) is discouraged and might cause failures and unexpected behavior Generator 'CMakeDeps' calling 'generate()' Aggregating env generators Generated conaninfo.txt Generated graphinfo
-- Configuring done
-- Generating done
-- Build files have been written to: F:/GitRepo/cmake-conan-setup/build/win32-msvc-x64-ninja-debug/conan-dependencies/build
-- Using Conan toolchain: F:/GitRepo/cmake-conan-setup/build/win32-msvc-x64-ninja-debug/conan-dependencies/conan_toolchain.cmake
CMake Error at CMakeLists.txt:2 (project):


  does not support platform specification, but platform


  was specified.

-- Configuring incomplete, errors occurred!
See also "F:/GitRepo/cmake-conan-setup/build/win32-msvc-x64-ninja-debug/CMakeFiles/CMakeOutput.log".

It is because the default generator on Windows is Visual Studio generator. Therefore the conan_toolchain.cmake generated by CMakeToolchain will have the following two lines, which shouldn’t be specified when using Ninja generator.


Hope Conan Team take over this project

I’m willing to transfer this project if Conan Team thinks it is worth maintaining. Here are the reasons:

  • I haven’t mastered all the skills and techniques of Git/GitHub. So I’m afraid that I might mess up this project if someone do some PRs for it later.
  • I only test compilers on Windows platform. Since I have a little experience on Ubuntu and zero experience on MacOS, I’m not able to deal with the issues about other platforms (for now).
  • This project is a downstream project of cmake-conan, so it might have some upstream problems.
  • As a college student, I need to prepare a big exam in a few months. So I don’t have much time to debug this project later. (Most Important)

And my requests are:

  • Mark me as the Original Arthor of this project.
  • Add me as a collaborator.

Alternatively, if Conan Team wants to be collaborators of this project, then I can add them into this project.

If Conan Team has the willingness, please let me know. Thanks.


Issue Analytics

  • State:open
  • Created 4 months ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

czoidocommented, Nov 4, 2022


I wanted to aplogize if my tone seemed combatibe, It was not the intention at all. I really wanted to know If I you had some issues I could help you with. Also, thanks a lot for your kind words regarding Conan, we try to do our best and we are very sorry if things break from time to time, I know it can be very frustrating. Regarding this project, as I said to @hwhsu1231 in the previous comment we will listen to all users feedback and try to offer the best solution we can come with, but sadly that will be after Conan 2.0 as we don’t have the resources now to tackle it.

Thanks a lot for your feedback.

saukijancommented, Nov 4, 2022

sure @czoido, I opened issues both on conan-io and conan-center-index as well as contributed packages I also chimed in on existing issues, when relevant.

Regarding breaking changes, the artifactory migration comes to mind first. Sure it was not your fault, but it definitely was handled poorly. After that, the SSL certification issues, which caused the whole service outage, then pre v1.43 conan simply not working with the new conan-center, now this planned conan v2.0 changes and deprecation of cmake-conan and old cmake generators. It adds up and makes it harder than necessary to get conan adopted in-house as a standard tool, especially when we have to keep telling devs: “Oh it’s a conan issue, we know. Wait for the next conan update that should fix it” - it erodes trust in the tool as a whole and trust is already hard to build up.

Change is always hard and painful, I get that, but asking devs to have to keep changing their workflow to make a package manager work simply is ridiculous, especially when it comes out of the blue (though this is more of a personal problem of not keeping up with conan blogs)

I understand that folks have a lot on their plate and that you feel like the whole community is trying to pull you in different and contradicting directions. Conan project looks really great and the idea of it is of great value to the C++ community as a whole, but this combative tone really paints a bad picture of, a simple “Thanks for your work, we will look into it later” instead would go much further.

I want to love conan and help it grow into the defacto C++ package manager, but this whole affair makes me second guess that desire.

Read more comments on GitHub >

github_iconTop Results From Across the Web

hwhsu1231/cmake-conan-setup - GitHub
0. Motivation. This project aims to provide a NONINTRUSIVE way to integrate CMake with Conan using cmake-conan. It is because the typical usage...
Read more >
CMakeToolchain — conan 1.28.2 documentation
The CMakeToolchain can be used in the toolchain() method: from conans import ConanFile, CMake, CMakeToolchain class App(ConanFile): settings = "os", "arch", ...
Read more >
Conan Integration — ApprovalTests.cpp documentation
This example use Conan's cmake Generator. The conanfile.txt file lists the required libraries, and which generator to use (here, conan ):.
Read more >
Conan with cmake-conan missing conanbuild.conf
I am want to package a CMake project with conan. For that I use the following : import os from conans import...
Read more >
conan with modern cmake and namespacing : r/cpp - Reddit
I have gone through Mateusz Pusz's cmake/conan update in 2021 ... conan_paths , or for 2.0 with the new CMake toolchain without CMakeDeps)....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found