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

Malfettone, Kris Kris.Malfettone at sig.com
Wed Feb 15 08:26:40 EST 2017


Good to know.  Thanks for the quick response.  Though I do not believe I am violating that particular rule here.  That is why I do not receive either a warning or error from CMake in my output.

The only warning I see is from ninja:
ninja: warning: multiple rules generate MD/MDF/Formats/SIG/BCP/v0_1/test. builds involving this target will not be correct; continuing anyway [-w dupbuild=warn]
ninja: warning: multiple rules generate MD/MDF/Formats/SIG/BCP/v0_2/test. builds involving this target will not be correct; continuing anyway [-w dupbuild=warn]
ninja: warning: multiple rules generate test. builds involving this target will not be correct; continuing anyway [-w dupbuild=warn]

I think the difference is that my target names are:
MD.MDF.Formats.SIG.BCP.v0_1.test
MD.MDF.Formats.SIG.BCP.v0_2.test

It is the ninja generator that is trying to setup aliases for each of them as a shortened form.  So I think one of the following statements are true:

*         The cmake rule intended for the above two target names to be invalid.  But the check to issue a warning or error has a bug causing them to be missed.  This would explain why I do not get the error in my configure results.

*         The cmake rule intended for the above two target names to be valid.  However, on further reflection the rule should be made stricter to include my target names above.  This would then require and update to the cmake code checking that policy and lead to me actually getting a warning or error from cmake during configure.

*         The ninja generator has a bug and is setting up ambiguous aliases for what CMake considers valid target names.

My project is huge so I will try and craft a simplified CMakeLists.txt example to reproduce the problem as well.

Does this make sense?  Am I still missing something?

-Kris


From: Nils Gladitz [mailto:nilsgladitz at gmail.com]
Sent: Wednesday, February 15, 2017 3:36 AM
To: Malfettone, Kris <Kris.Malfettone at msx.bala.susq.com>; cmake at cmake.org
Subject: Re: [CMake] Potential bug: Having executables named "test" causes Ninja generator to generate ambiguous rules...

On 14.02.2017 22:53, Malfettone, Kris wrote:
If so, are executables named "test" no longer supported?
Am I missing something or wrong in some way?


Issues existed before 3.0 but since 3.0 "test" and similarly problematic target names have been explicitly reserved.

Any CMake Version >= 3.0 will issue a warning (when the required version is < 3.0) or an error (when the required version is >= 3.0) by default:
    https://cmake.org/cmake/help/v3.8/policy/CMP0037.html

Nils

________________________________

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/20170215/071f136b/attachment.html>


More information about the CMake mailing list