Hi,

For a simple test I've got the following directory structure:

|- build
|- project
|  |- CMakeLists.txt
|  |- Main.cpp
|- CMakeLists.txt
|- Test.cpp

project/CMakeLists.txt has the following content:

  cmake_minimum_required(VERSION 3.12)

  project(Reproducer LANGUAGES CXX)

  add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/.." 
"${CMAKE_CURRENT_BINARY_DIR}/..")

  add_executable(Reproducer)
  target_sources(Reproducer PRIVATE Main.cpp)
  target_link_libraries(Reproducer PRIVATE ReproducerLibrary)


And CMakeLists.txt has the following content:

  add_library(ReproducerLibrary OBJECT)
  target_sources(ReproducerLibrary PRIVATE Test.cpp)


When I now run the commands:

cd build
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?

Regards,
Daniel
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

Reply via email to