Having executables named "test" causes Ninja generator to generate ambiguous rules...
I first posted this on the users mailing list but thought at this point it was definitely a bug and wanted to report it here. The basic gist is this:
The code that produces the "# Target aliases." section of the build.ninja seems to try and avoid ambiguities between targets but fails to consider built in cmake targets such as "test,install,install/strip,etc...". This way when executables are named "test" (please note that their target names are both unique and not "test") they cause the ninja generator to create ambiguous targets.
There is a fair bit of description and small example CMakeLists.txt setup to reproduce the problem in this thread: http://public.kitware.com/pipermail/cmake/2017-February/065004.html
In particular steps to reproduce are here: http://public.kitware.com/pipermail/cmake/2017-February/065014.html
Top level CMakeLists.txt:
cmake_minimum_required(VERSION 3.7) enable_testing() project("bugreproduce") add_subdirectory("subdir") add_subdirectory("subdir2")
Subdir with CMakeLists.txt:
add_executable( "Foo.test" foo_test.cpp ) set_target_properties("Foo.test" PROPERTIES OUTPUT_NAME test ) add_test(NAME "Foo.test" COMMAND test)
subdir2 with CMakeLists.txt:
add_executable( "Bar.test" bar_test.cpp ) set_target_properties("Bar.test" PROPERTIES OUTPUT_NAME test ) add_test(NAME "Bar.test" COMMAND test )
Contents of both source files (obviously in their respective subdirectories):
int main( int, char** ) { return 0; }
If you need any other information please feel to contact me.
Thanking you in advance,
Kris