[CMake] Potential bug: Having executables named "test" causes Ninja generator to generate ambiguous rules...

Malfettone, Kris Kris.Malfettone at sig.com
Tue Feb 14 16:53:19 EST 2017


Hi,
I am trying to migrate a very large project from cmake 2.8.11.2 + ninja 1.3.4 to cmake 3.7.2 + ninja 1.7.2 and found what might be a bug with the ninja generator.  In my project we have a number of executables that are named "test".  This is normally not a problem since each one as a different target name that is unique.  However, with the move to CMake 3.7.2 the Ninja generator seems to generate ambiguous target aliases for the project.  If I rename my outputs to something such as "testfoo", the problem goes away.  Looking at the build.ninja that is generated there are clearly multiple ambiguous targets.  One that I generates the output file named "test" and one I believe meant to run our unit tests.  That second part I believe is what is different between the versions of CMake that I am using.

The other thing is I believe even if those are removed there would be a final ambiguity between my executable and built in "test" command because the portion of the code the generates the section of the build.ninja file commented as "# Target aliases." seems to try and avoid ambiguities between targets but fails to consider built in cmake targets such as "test,install,install/strip,etc..."

Again, I am not a build.ninja expert so I may be wrong in my understanding.  Some further info, this does not occur on windows because on windows the targets all end with ".exe" and it does not happen with the Makefile generator on Linux.

Is this expected behavior?
If so, are executables named "test" no longer supported?
Am I missing something or wrong in some way?

Any help would be appreciated.

Thanks,
Kris Malfettone

________________________________

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170214/1634fa09/attachment.html>


More information about the CMake mailing list