question-mark
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.

conan_cmake_run fails when conan is installed locally (not system-wide)

See original GitHub issue

CMake:

if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
    message(STATUS "Downloading conan.cmake from https://github.com/memsharded/cmake-conan")
    file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/master/conan.cmake"
            "${CMAKE_BINARY_DIR}/conan.cmake")
endif()

include(${CMAKE_BINARY_DIR}/conan.cmake)
conan_cmake_run(CONANFILE conanfile.txt  # or relative build/conanfile.txt
                BASIC_SETUP CMAKE_TARGETS
                BUILD missing)

Output:

-- Conan ** WARNING** : This detection of settings from cmake is experimental and incomplete. Please check 'conan.cmake' and contribute
-- Conan executing: conan install -f=/home/sztomi/Projects/MyCoolProject/conanfile.txt -g cmake -s build_type=Debug -s os=Linux -s compiler=gcc -s compiler.version=6.3 -s compiler.libcxx=libstdc++11 --build=missing
CMake Error at cmake-build-debug/conan.cmake:221 (message):
  Conan install failed='No such file or directory'
Call Stack (most recent call first):
  cmake-build-debug/conan.cmake:298 (conan_cmake_install)
  CMakeLists.txt:14 (conan_cmake_run)

However, when I run the same command from the command line, it works. Tried CMake 3.7 (bundled) and 3.8 with the same result.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:19 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Sebanisucommented, May 25, 2022

I ended up using sudo ln -s ~/.local/bin/conan /usr/bin/conan both methods work I didn’t know I could use the find_program outside the conan.cmake. I had a custom conan.cmake for a while where I was doing that.

2reactions
sztomicommented, May 14, 2017

Interestingly, it fails the same way in KDevelop. My guess is that the conan executable is not found because I don’t have it system-wide installed (I installed via pip install conan --user, so it lives in ~/.local/bin)

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found