add_custom_command results in bogus dependency loop
The repo is https://github.com/phma/quadlods and the commit is "Attempt to make primes.dat a target".
I need to install primes.dat, which is made by running "quadlods sortprimes", in what will be /usr/share/quadlods/ when it's packaged. I added the line
add_custom_command(OUTPUT primes.dat COMMAND quadlods ARGS sortprimes MAIN_DEPENDENCY quadlods)
to CMakeLists.txt and not only did it not make primes.dat when told to, which is written about elsewhere, it also produced a bogus dependency loop:
-- Configuring done
CMake Error: The inter-target dependency graph contains the following strongly connected component (cycle):
"quadlib1" of type SHARED_LIBRARY
depends on "quadlods" (strong)
"quadlods" of type EXECUTABLE
depends on "quadlib1" (weak)
At least one of these targets is not a STATIC_LIBRARY. Cyclic dependencies are allowed only among static libraries.
-- Build files have been written to: /home/phma/build/quadlods/dbg
Makefile:581: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
quadlods does depend on quadlib1, but the only things quadlib1 depends on are quadlods.cpp, which is a source file, and its include file quadlods.h.
The CMake version is 3.9.1, from the package in Artful Aardvark running on Intel Core I7.