MantisBT - CMake
View Issue Details
0014497CMakeCMakepublic2013-10-21 03:512016-06-10 14:31
Gregoire 
Robert Maynard 
normalminoralways
closedmoved 
CMake 2.8.12 
 
0014497: Ninja & CMake 2.8.12: warning when generating resource file out of source tree

Issue happens when I generate a resource file in the build tree (out of source) on windows (msvc or mingw) using "Ninja" generator.

If I generate the resource inside the source tree, no issue.
If I generate a source (not a resource), no issue for both in source and build trees.
If I use native build tool (nmake or mingw32-make), no issue.
(See attached project)
Under Windows, use Ninja generator under windows in an out of source build tree to generate the project.
The warning is displayed at build time when invoking ninja.
No tags attached.
zip sources-ninja-resource-warning.zip (1,337) 2013-10-21 03:51
https://public.kitware.com/Bug/file/4910/sources-ninja-resource-warning.zip
Issue History
2013-10-21 03:51GregoireNew Issue
2013-10-21 03:51GregoireFile Added: sources-ninja-resource-warning.zip
2013-10-21 03:53GregoireNote Added: 0034176
2013-10-21 10:36Brad KingAssigned To => Peter Kuemmel
2013-10-21 10:36Brad KingStatusnew => assigned
2013-11-24 10:59Thomas SondergaardNote Added: 0034535
2013-11-25 03:40Peter KuemmelAssigned ToPeter Kuemmel => Robert Maynard
2013-11-25 03:45Peter KuemmelNote Added: 0034538
2013-11-25 09:12Robert MaynardNote Added: 0034548
2013-11-25 12:09Peter KuemmelNote Added: 0034552
2013-11-25 12:16Peter KuemmelNote Added: 0034553
2013-11-25 13:35Robert MaynardNote Added: 0034554
2013-11-25 15:51Peter KuemmelNote Added: 0034555
2013-11-25 16:22Robert MaynardNote Added: 0034556
2013-11-25 16:28Peter KuemmelNote Added: 0034557
2013-11-25 16:30Robert MaynardNote Added: 0034558
2013-11-25 16:39Peter KuemmelNote Added: 0034559
2013-11-26 06:19Peter KuemmelStatusassigned => confirmed
2014-02-07 04:12GregoireNote Added: 0035047
2014-07-24 11:38GregoireNote Added: 0036452
2014-07-30 05:53Thomas SondergaardNote Added: 0036495
2016-06-10 14:29Kitware RobotNote Added: 0042397
2016-06-10 14:29Kitware RobotStatusconfirmed => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0034176)
Gregoire   
2013-10-21 03:53   
Nicolas Despres told me that he could not reproduce this issue on Linux:

"I did not succeed to reproduce it on Linux. The rc file gets removed from the executable source list."
(0034535)
Thomas Sondergaard   
2013-11-24 10:59   
I am seeing this warning too for a generated rc file (out of source)
(0034538)
Peter Kuemmel   
2013-11-25 03:45   
This bug is a regression due to this commit:

http://cmake.org/gitweb?p=cmake.git;a=commit;h=539356f1281902f5494828eca963d95e2b726dda [^]

It adds rules like

build A: phony A

which make not much sense.

There should be a better solution to the mentioned issue described in the commit message.
(0034548)
Robert Maynard   
2013-11-25 09:12   
I am interested in finding a better way to handle unknown output of custom commands, but currently I don't know a better way.

Currently the output of calls such as add_custom_command( PRE_BUILD | PRE_LINK | POST_BUILD ...) don't have a way to list which files they are going to generate. Those file could be listed as source files for another target. Without something like the mentioned commit, ninja won't run at all for projects using those commands.
(0034552)
Peter Kuemmel   
2013-11-25 12:09   
Do you have a test case?

Will it work when you change it to this:

build A-phony: phony /a/absolute/path/to/A
(0034553)
Peter Kuemmel   
2013-11-25 12:16   
Ninja docu:

phony can also be used to create dummy targets for files which may not exist at build time. If a phony build statement is written without any dependencies, the target will be considered out of date if it does not exist. Without a phony build statement, Ninja will report an error if the file does not exist and is required by the build.

http://martine.github.io/ninja/manual.html#_the_literal_phony_literal_rule [^]
(0034554)
Robert Maynard   
2013-11-25 13:35   
I am confused. The above commit goals is to create dummy targets for files which don't exist at build time.

The test that exposes this problem is:
http://cmake.org/gitweb?p=cmake.git;a=commit;h=88d27ad0140ac2274e886c10ac2bf9f8eede54c7 [^]
(0034555)
Peter Kuemmel   
2013-11-25 15:51   
Sorry for the confusion ;)

But now I think the problem is that resources files are not unknown, see the exmaple CMakeLists.txt:

set (_target_rc "versioninfo.rc")
-> does not trigger creation of phone rule

set (_target_rc "${CMAKE_BINARY_DIR}/versioninfo.rc")
-> triggers phony rule creation


So it's because of the absolute path.
(0034556)
Robert Maynard   
2013-11-25 16:22   
Yeah we will need to dig into this. I expect that the problem is that we aren't converting it to a ninja path when adding it to the knownDependencies set inside the WriteUnknownExplicitDependencies method.

That would explain why when it is a relative path we see the ninja generator behaving properly, but when
being an absolute path it doesn't.
(0034557)
Peter Kuemmel   
2013-11-25 16:28   
BTW, absolute/relative path handling in the ninja generator is really a mess, for instance here

http://public.kitware.com/Bug/view.php?id=13894 [^]

I finally have to revert.
(0034558)
Robert Maynard   
2013-11-25 16:30   
Have to revert what?
(0034559)
Peter Kuemmel   
2013-11-25 16:39   
I had to revert the patch of the ticket 0013894.
(0035047)
Gregoire   
2014-02-07 04:12   
Could this issue be fixed in a 2.x.x version? I need some 2.8.12 features but I cannot upgrade due to this issue.
(0036452)
Gregoire   
2014-07-24 11:38   
I do not see this issue any more with CMake 3.0.0 and the attached sample.
(0036495)
Thomas Sondergaard   
2014-07-30 05:53   
I'm also not seeing these warnings anymore after upgrading to CMake 3.0.0. I've tested with ninja 1.4.0 and ninja 1.5.1.
(0042397)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.