Skip to content

FetchContent: Build fails if FETCHCONTENT_SOURCE_DIR_<UC_NAME>=<bad folder>

This seems like a bug, or at least an exception warranting a warning message.

If I already have an operating CMake build but then attempt a "developer override" by

cmake -G .. -S.. -B.. -DFETCHCONTENT_SOURCE_DIR_MYDEP=<bad folder>

the subsequent cmake --build and cmake --install will forget that MYDEP even exists (kinda' makes sense since FetchContent doesn't find a CMakeLists.txt for MYDEP). The <bad folder> in this case is a path that simply doesn't exist.

The evidence for failure is that MYDEP fails to show up in the lines of [ xx%] Built target XXX emitted by --build. More evidence is --install .. --component mydep fails to emit anything beyond the 1st line -- Install configuration:.

I'm using CMake 3.16 on Win10/Pro/64.

Edited by Brad King
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information