It’s not /Dir1
, it’s Dir1
. By putting the /
before the directory you’ve made it into an absolute path, literally saying “Dir1
in the root of the entire filesystem”.
You almost certainly want a relative path, no leading slash. Relative paths in most CMake contexts, including target_sources()
, are relative to the current source directory