Search code examples
cmakeconan

Repository clean up


I am adding Conan support to my CMake projects. I followed Recipe and sources in the same repo tutorial and I end up with the expected package. Exploring the local repository folder, I found out that my source files are copied in 3 different folders (source, build and export_source) so the repo is growing fast even with small projects.

Is there a way to clean repository folders where sources are duplicated, after package creation (keeping only the folder needed for "dependency build from sources")?


Solution

  • Sure, you can remove things from the cache with the conan remove command. In this case you probably want to do:

    conan remove "*" -s -b -f
    
    • * to match all packages in your local cache
    • -s to remove the source folders
    • -b to remove the build folders
    • -f to not ask for confirmation

    The sources stored together with the conanfile.py in the cache, can't be removed, cause they are stored with the conanfile to be able to rebuild from sources when conan install --build is done.