conan.tools.layout

Warning

This is an experimental feature subject to breaking changes in future releases. The layout() feature will be fully functional only in the new build system integrations (in the conan.tools space). If you are using other integrations, they might not fully support this feature.

Predefined layouts

There are some pre-defined common layouts, ready to be simply used in recipes:

The predefined layouts define a few things, for example in the cmake_layout() the source folder is called ".", meaning that Conan will expect the sources in the same directory where the conanfile is (most likely the project root, where a CMakeLists.txt file will be typically found). This could be customized without fully changing the layout:

def layout(self):
    cmake_layout(self)
    self.folders.source = "mysrcfolder"

Even if this pre-defined layout doesn’t suit your specific projects layout, checking how they implement their logic shows how you could implement your own logic (and probably put it in a common python_require if you are going to use it in multiple packages).