FetchContent does not add anything to the header search path. Most likely it is the project being added that is itself adding that header search path. If a project is unilaterally adding CMAKE_SOURCE_DIR
instead of CMAKE_PROJECT_SOURCE_DIR
or CMAKE_CURRENT_SOURCE_DIR
as a header search path (or just about any other use for that matter), then you need to work with that project and suggest they make that change. Some projects were not originally written to expect to be incorporated into another build via add_subdirectory()
and this is one of the more common problems that are a symptom of that. The fixes are usually easy, but require the cooperation of the project maintainer.