[feature] location of the generated CMakeUserPresets.json
See original GitHub issueThe 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.
- I’ve read the CONTRIBUTING guide.
 
Issue Analytics
- State:
 - Created a year ago
 - Comments:6 (3 by maintainers)
 

Top Related StackOverflow Question
I would just like to add another observation. I have been using
CMakeSettings.jsonwhich is Visual Studio specific and a kind of precursor forCMakePresets.json. Since the latest VS 2022 Microsoft is officially promoting usingCMakePresets.jsoninstead ofCMakeSettings.jsonwhich is definitely a good move.However, the way
CMakeSettings.jsonwere andCMakePresets.jsonare supposed to be used in VS IDE is quite different from whatconanexpects. So basically neitherconangeneratedCMakePresets.json, norCMakeUserPresets.jsonare really useful (in VS IDE context) and one would rather want a handcraftedCMakePresets.jsonwhich will includeconan_toolchain.cmakeas it did before, and would not want havingconanmessing with that. So an option to not generate those files could be useful too.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.