<div dir="ltr"><div dir="ltr"><div dir="ltr">Hello,<div>according to the doc for CMake 3.14, target_sources() interprets relative source file paths as being relative to the current
source directory, i.e. it should <br></div><div>prepend CMAKE_CURRENT_SOURCE_DIR to the relative paths given by the user. However, this is not the case if the target and the sources are defined in the same directory.</div><div>I attached a simple example to reproduce the issue. The structure of the example is as follows:</div><div><br></div><div>- cmake-bug/</div><div> - CMakeLists.txt</div><div> - main.cpp </div><div> - foo/</div><div> - CMakeLists.txt</div><div> - foo.H</div><div> - foo.cpp</div><div> - bar/</div><div><div> - CMakeLists.txt</div><div> - bar.H</div><div> - bar.cpp</div></div><div><br></div><div>Target "main.exe" is defined in the top-level CMakeLists.txt, while its headers and sources are located in the the top-level directory</div><div>and in the sub-directories 'foo' and 'bar'.</div><div>After target_sources is used to include all the headers and sources, I retrieve the "SOURCES" property for `main.exe`: all the sources and headers</div><div>but `main.cpp` are given the correct (absolute) path.</div><div><br></div><div>Is this the intended behavior? If so, why should a source file located in the same directory where the target is defined be treated any differently?<br></div><div><br></div><div>Thanks,</div><div><div><div dir="ltr" class="gmail_signature"><div dir="ltr">Michele</div></div></div></div></div></div></div>