Since #4282 (72f27cb in particular) it's no longer possible to add libgit2 to another cmake project with add_subdirectory. The uses of CMAKE_CURRENT_SOURCE_DIR changed to CMAKE_SOURCE_DIR which only works if libgit2 is the root project. I'd suggest that cmake list files in subdirectories that need to refer to the root of the libgit2 source tree should use libgit2_SOURCE_DIR instead.