Skip to content

[FEA] detect and clean out build dirs if building in a central location #2

Description

@trxcllnt

Related to #1, sometimes project dependencies fail to build for various reasons. Doing a clean rebuild of the dependent project won't detect that one of its dependencies didn't build and clean-build it too, because clean builds of the dependent project don't (shouldn't?) clean out the dependency build cache.

It's kind of a hacky solution, but we have a CMake function that checks whether the files for a dependency exist, and if not, deletes ${FETCHCONTENT_BASE_DIR}/${pkg}-build and ${FETCHCONTENT_BASE_DIR}/${pkg}-subbuild directories before calling CPMFindPackage:

function(_clean_build_dirs_if_not_fully_built dir soname)
  if (NOT EXISTS "${CPM_BINARY_CACHE}/${dir}-build/${soname}")
    file(REMOVE_RECURSE "${CPM_BINARY_CACHE}/${dir}-build")
    file(REMOVE_RECURSE "${CPM_BINARY_CACHE}/${dir}-subbuild")
  endif()
endfunction()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions