For a simple test I've got the following directory structure:
| |- CMakeLists.txt
| |- Main.cpp
project/CMakeLists.txt has the following content:
project(Reproducer LANGUAGES CXX)
target_sources(Reproducer PRIVATE Main.cpp)
target_link_libraries(Reproducer PRIVATE ReproducerLibrary)
And CMakeLists.txt has the following content:
target_sources(ReproducerLibrary PRIVATE Test.cpp)
When I now run the commands:
cmake.exe -G Ninja ..\..\project
cmake.exe --build .
Then I get the error:
ninja: error: '<absolute-path>/ReproducerLibrary.dir/Test.cpp.obj', needed by 'Reproducer.exe', missing and no known rule to make it
I noticed, that the build.ninja the build rule for Test.cpp.obj has a relative path, whereas the link dependency to Test.cpp.obj is an absolute path.
Is this a known issue?