conan-io / examples2

Conan 2.x examples
MIT License
89 stars 49 forks source link

Changed conanfile.py namings as they were failing the build process #88

Closed firaatozkan closed 1 year ago

firaatozkan commented 1 year ago

Changed tc.user_presets_path = 'ConanPresets.json' to tc.user_presets_path = 'CMakePresets.json'.

I also changed "release" and "debug" names used for CMake presets to have "conan-" before their names.

firaatozkan commented 1 year ago

Maybe if you could, could you delete the ConanPresets.json and run the commands in the "run_example.py" step by step? I think you will agree with me then.

Cheers, Fırat

memsharded commented 1 year ago

Hi @firaatozkan

Not sure what you mean. The example you are changing has CI enabled, it is being tested and it seems to work fine, while your changes seems to break it, you can have a look to https://ci.conan.io/blue/organizations/jenkins/Examples2.0/detail/PR-88/1/pipeline

What ConanPresets.json is to be deleted, there is no such file in the repo https://github.com/conan-io/examples2/tree/main/examples/tools/cmake/cmake_toolchain/extend_own_cmake_presets, it is automatically created, then it is included by the existing user CMakePresets.json in https://github.com/conan-io/examples2/blob/main/examples/tools/cmake/cmake_toolchain/extend_own_cmake_presets/CMakePresets.json#L3, if that file doesn't exist, it will obviously fail

firaatozkan commented 1 year ago

Okay, what I meant here was that: I'd been fooling around to see if I can create a basic template for a C++ project. I deleted all files but CMakeLists.txt and conanfile.py. Then I ran the commands in conanfile.py, step by step.

After I ran "cmake --preset " command for both Debug and Release configuration, I got the same error that a CMake preset was not found in the directory of the example. So I decided to change the name in the conanfile.py to a "CMakePresets.json" and all worked just fine.

I realized that the conanfile.py creates a ConanPresets.json file, but I think this file was meant to be named "CMakePresets.json", just like the one in the repository. Because the file structure of ConanPresets.json is that of a "CMakePresets.json" file. The example may work fine, because it already has a "CMakePresets.json" file.

I hope I could be clear :)

memsharded commented 1 year ago

Okay, what I meant here was that: I'd been fooling around to see if I can create a basic template for a C++ project. I deleted all files but CMakeLists.txt and conanfile.py. Then I ran the commands in conanfile.py, step by step.

Ok, yes, that clarifies a bit the issue. Let me clarify also the purpose of this example folder which implements this user story:

If you are removing the CMakePresets.json you are invalidating the starting hypothesis of this particular example.

So it seems mostly a confusion about the purpose of this example and this folder, it would be better to start from another starting point, and leave this folder as-is, because it still seems correct and working fine. If you have some general question about the generated presets by Conan you can create a question in the main Conan client repo. Thanks!

firaatozkan commented 1 year ago

Thank you for your clarification and your time!