No, a CMakePresets.json file can only live in the same directory as the top level CMakeLists.txt of a project. You could create a CMakePresets.json file in each of your myproject and externa/external-project directories, or you could add a CMakeLists.txt to the top of your directory structure and have that add one of the other two directories, but I suspect neither is really going to give you quite what you were aiming for.
Thank you for the clarification. I really appreciate it.
If I create CMakePresets.json for each project, which seems reasonable, do I have to navigate into the project folder to leverage the presets?
Can I reference the external-project preset commands from the my-project preset and trigger compilation of external-project from my-project? Or preset “libraries” (through "include": ... are supposed to live within a CMakeLists.txt enabled project?
If you want a top level CMakePresets.json to work, you’ll need a top level CMakeLists.txt as well. You would need to put the logic in that top level CMakeLists.txt to select between the projects in the subdirectories. You could have the top level CMakePresets.json set a CMake cache variable that you query in the top level CMakeLists.txt to work out which one to pull in. Your top level CMakePresets.json can include the subdirectories’ CMakePresets.json files, but I doubt that will be what you want. You would not be able to have any presets with the same names across the subdirectories, for example. Any paths in the presets would also likely be wrong, or at least, have to be specified in a way that doesn’t matter which directory is the top level of the build.
Take a look at the ExternalProject module. It sounds like that might be relevant to you, but it depends on what you’re trying to achieve. It might not fit with the way you want to do things, and it comes with its own advantages and disadvantages, but it is worth mentioning in the conversation.