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.

[bug] missing CMakeUserPresets.json

See original GitHub issue

Conan 1.48.0 does not generate CMakeUserPresets.json if conanfile.txt used instead of .py.

Probably this is duplicate of #11172.

Environment Details

  • Operating System: linux
  • Conan version: 1.48.0

Steps to reproduce

cd "$(mktemp -d)"
conan new hello/0.1 -m=cmake_exe
rm conanfile.py
echo -e "[generators]\nCMakeToolchain" > conanfile.txt
mkdir build
(cd build && conan install ..)
tree "$(pwd)"

Output

/tmp/tmp.6FdEpSMGTR
β”œβ”€β”€ CMakeLists.txt
β”œβ”€β”€ build
β”‚Β Β  β”œβ”€β”€ CMakePresets.json
β”‚Β Β  β”œβ”€β”€ conan.lock
β”‚Β Β  β”œβ”€β”€ conan_toolchain.cmake
β”‚Β Β  β”œβ”€β”€ conanbuildinfo.txt
β”‚Β Β  β”œβ”€β”€ conaninfo.txt
β”‚Β Β  └── graph_info.json
β”œβ”€β”€ conanfile.txt
β”œβ”€β”€ include
β”‚Β Β  └── hello.h
β”œβ”€β”€ src
β”‚Β Β  β”œβ”€β”€ hello.cpp
β”‚Β Β  └── main.cpp
└── test_package
    └── conanfile.py

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
lasotecommented, May 27, 2022

We have finally implemented https://github.com/conan-io/conan/pull/11348 to be released in Conan 1.49. So you can declare:

[layout]
cmake_layout

in the conanfile.txt to get the CMakeUserPresets.json generated correctly

1reaction
memshardedcommented, May 18, 2022

Does it mean that usage of .txt is discouraged and will be deprecated in 2.0?

No, the .txt will still be there. And the new CMake integration will still generate a CMakePresets.json file, it is only the CMakeUserPresets.json that might be generated under certain conditions (it is not already existing), and that might be used to aggregate multiple different configurations (each one might have a different CMakePresets.json in a different folder), but for this functionality to be manageable, a layout is necessary, otherwise it becomes too messy. So it is the CMakeUserPresets.json that only will be generated for more advanced cases that will require a conanfile.py, while for simple usage a conanfile.txt with the CMakePresets.json would be the solution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configure and build with CMake Presets in Visual Studio
CMakeUserPresets.json is for developers to save their own local builds. ... You'll see an error if you try to use the same Configure...
Read more >
Proposal for buildPresets and testPresets in CMakePresets.json
A simple CMakePresets.json with build, configure, and test support could look ... may not inherit from presets in CMakeUserPresets.json.
Read more >
CMake Project Manager: Support presets functionality
CMake upstream is getting at https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5169 the ability to configure a project with a CMakeSettings.json file.
Read more >
How to change default-generated CMakeCache in VS Code
json file is for defining presets that could be useful to anyone, and a CMakeUserPresets.json file is for each user to define presets...
Read more >
Why is it disallowed for project preset to inherit user preset?
CMake Error: Could not read presets from PATH: Project preset ... want to inherit anything from some random person's CMakeUserPresets.json ...
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