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] location of the generated CMakeUserPresets.json

See original GitHub issue

The Conan documentation states:

If you declare a layout() in the recipe and your CMakeLists.txt file is found in the conanfile.source_folder folder, Conan will place a CMakeUserPresets.json to include the CMakePresets.json generated with the above specification.

However, there is no way to set the source folder from the conan install command. Besides the obvious use case to override the defaults from the command line, such an option could also be useful in big projects to select which directory with CMakeLists.txt should be used as an entry point for CMake build. For example, if I have several standalone subprojects in the tree and only one conanfile.py to define the dependencies with conan install --source-folder I could control where the CMakeUserPresets.json is being generated and then build such a subproject in isolation using CMake presets.

Alternatively, CMakeUserPresets.json could be generated in the path of conan install invocation, but probably this is a worse solution.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
risa2000commented, Oct 26, 2022

I would just like to add another observation. I have been using CMakeSettings.json which is Visual Studio specific and a kind of precursor for CMakePresets.json. Since the latest VS 2022 Microsoft is officially promoting using CMakePresets.json instead of CMakeSettings.json which is definitely a good move.

However, the way CMakeSettings.json were and CMakePresets.json are supposed to be used in VS IDE is quite different from what conan expects. So basically neither conan generated CMakePresets.json, nor CMakeUserPresets.json are really useful (in VS IDE context) and one would rather want a handcrafted CMakePresets.json which will include conan_toolchain.cmake as it did before, and would not want having conan messing with that. So an option to not generate those files could be useful too.

1reaction
lasotecommented, Jul 28, 2022

Hi, I renamed the issue and assigned it to the next release just to think about it. If we come up with some idea we could implement something.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CMakeUserPresets.json - Microsoft Learn
Specifies the path to a CMake cache. This directory should contain an existing CMakeCache.txt file. This key is only supported by the Open ......
Read more >
cmake-presets(7) — CMake 3.25.1 Documentation
CMakePresets.json and CMakeUserPresets.json live in the project's root directory. They both have exactly the same format, and both are optional (though at ...
Read more >
CMakeToolchain — conan 2.0.0-beta documentation
This attribute allows specifying the location of the generated CMakeUserPresets.json file. Accepted values: An absolute path; A path relative to self.
Read more >
Allow extending/overriding of existing presets (#23046) · Issues
So I'd want to do the following in my CMakeUserPresets.json: ... Besides I don't want to generate new presets, I use the same...
Read more >
An Introduction to CMakePresets.json - YouTube
Check out free documentation and modules on Microsoft Learn: https://docs.microsoft.com/en-us/cpp/?
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