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.

[feature] CMakeToolchain: prepend CMAKE_CURRENT_LIST_DIR instead of CMAKE_BINARY_DIR

See original GitHub issue

Currently, toolchain file generated by CMakeToolchain sets CMAKE_MODULE_PATH and CMAKE_PREFIX_PATH like this:

    # To support the cmake_find_package generators
    set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR} ${CMAKE_MODULE_PATH})
    set(CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR} ${CMAKE_PREFIX_PATH})

It would be more robust to prepend CMAKE_CURRENT_LIST_DIR since conan install could be called from an other directory than root build tree. Usually I call conan install in a subfolder (I like to call it conan_generators) to isolate specific conan generated build files from standard build artifacts. I can live with this behavior, I inject absolute path of this subfolder (or any folder on my system where Ive called conan install) into CMAKE_MODULE_PATH & CMAKE_PREFIX_PATH through cmake command line, but it would be nice if toolchain file was more robust.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
SpaceImcommented, Apr 15, 2021

AFAIK, CMAKE_CURRENT_LIST_DIR doesn’t refer to any CMakeLists.txt folder, but to the local folder where the cmake file referencing this variable lives. Since toolchain files is generated in the same folder than others conan generated file, it’s exactly the folder you want to append in CMAKE_MODULE_PATH & CMAKE_PREFIX_PATH.

0reactions
memshardedcommented, Apr 20, 2021

Merged https://github.com/conan-io/conan/pull/8810, will be released next 1.36

Read more comments on GitHub >

github_iconTop Results From Across the Web

[feature] Issues with the CMakeToolchain generator #11224
We are building custom workspace functionality for Conan 1 based on the existing code, but using CMakeToolchain and the new layout method ...
Read more >
CMakeToolchain — conan 1.53.0 documentation
The CMakeToolchain is the toolchain generator for CMake. It will generate toolchain files that can be used in the command line invocation of...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found