Hello,

I have a project where circular dependencies are generated when I use the Ninja generator, but not the default Unix Makefiles. I could create a minimal test like this:

$ cat CMakeLists.txt
add_subdirectory (ext ${PROJECT_BINARY_DIR}/ext)

$ cat ext/CMakeLists.txt
set (OUT ${CMAKE_CURRENT_LIST_DIR})

add_custom_command (OUTPUT ${OUT}/foo
    COMMAND touch ${OUT}/foo
    )

add_custom_target (foo ALL
    DEPENDS ${OUT}/foo
    )

add_custom_command (TARGET foo
    POST_BUILD
    COMMAND cp ${OUT}/foo ${CMAKE_BINARY_DIR}/foo
    )

$ touch ext/bar

$ cmake -G Ninja .
[...]

$ ninja
ninja: warning: multiple rules generate ext/foo. builds involving this target will not be correct; continuing anyway [-w dupbuild=warn] ninja: error: dependency cycle: ext/foo -> ext/CMakeFiles/foo.util -> ext/CMakeFiles/foo -> ext/foo

I used a freshly compiled CMake 3.8 and the latest binary ninja from https://github.com/Kitware/ninja/releases.

Ignacio
--

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:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to