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()
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}-buildand${FETCHCONTENT_BASE_DIR}/${pkg}-subbuilddirectories before callingCPMFindPackage: