In foo/CMakeLists.txt, based on this and this, I have the following
foo/CMakeLists.txt
SET (EXTERNAL_LIB_ROOT \"../../external_libs/\") ADD_LIBRARY (avcodec-debug