MantisBT - CMake
View Issue Details
0014167CMakeCMakepublic2013-05-23 16:592014-02-10 10:44
Reid Kleckner 
Robert Maynard 
normalminoralways
closedfixed 
WindowsWindows7
CMake 2.8.11 
CMake 2.8.12CMake 2.8.12 
0014167: ninja: source files including generated headers are not rebuilt after header change
Originally reported to ninja-build:
https://groups.google.com/forum/?fromgroups#!topic/ninja-build/WLFbu68lN5U [^]

The problem is that cmcldeps produces depfiles with paths that aren't identical (modulo case) to the ones used to identify artifacts in the build.ninja file.

Two things need to change to make implicit generated header deps work:
1. path separators need to match the build.ninja file
2. paths in the build dir should be relative to the build dir

I'll attach a patch that fixes the problem for me locally.
Unpack the attached cmake project and do the following from the project src dir:

1. cmake -GNinja .
2. ninja
3. modify the string in dir/header.txt
4. ninja # Observe that only one action is taken
5. ./foo.exe # Observe that the old string is printed
6. ninja # Observe that the build finishes
7. ./foo.exe # Now the new string is printed
No tags attached.
zip gen_header.zip (1,180) 2013-05-23 16:59
https://public.kitware.com/Bug/file/4767/gen_header.zip
patch 0001-Make-cmcldeps-depfile-output-more-consistent-with-ni.patch (3,553) 2013-05-23 17:00
https://public.kitware.com/Bug/file/4768/0001-Make-cmcldeps-depfile-output-more-consistent-with-ni.patch
Issue History
2013-05-23 16:59Reid KlecknerNew Issue
2013-05-23 16:59Reid KlecknerFile Added: gen_header.zip
2013-05-23 17:00Reid KlecknerNote Added: 0033123
2013-05-23 17:00Reid KlecknerFile Added: 0001-Make-cmcldeps-depfile-output-more-consistent-with-ni.patch
2013-05-24 08:40Brad KingAssigned To => Robert Maynard
2013-05-24 08:40Brad KingStatusnew => assigned
2013-05-24 08:41Brad KingTarget Version => CMake 2.8.12
2013-05-24 10:22Robert MaynardNote Added: 0033128
2013-05-24 10:22Robert MaynardStatusassigned => acknowledged
2013-06-11 16:17Bill HoffmanNote Added: 0033273
2013-06-20 08:42bamiauxNote Added: 0033342
2013-07-23 09:44Reid KlecknerNote Added: 0033581
2013-07-23 10:30Robert MaynardNote Added: 0033582
2013-08-08 13:08Robert MaynardNote Added: 0033685
2013-08-08 13:08Robert MaynardStatusacknowledged => resolved
2013-08-08 13:08Robert MaynardFixed in Version => CMake 2.8.12
2013-08-08 13:08Robert MaynardResolutionopen => fixed
2014-02-10 10:44Robert MaynardNote Added: 0035069
2014-02-10 10:44Robert MaynardStatusresolved => closed

Notes
(0033123)
Reid Kleckner   
2013-05-23 17:00   
This patch fixes things for me. Please apply, or tell Mario if the princess is in another castle.
(0033128)
Robert Maynard   
2013-05-24 10:22   
Thanks for the patch I will be getting them into CMake next week.
(0033273)
Bill Hoffman   
2013-06-11 16:17   
Robert, can you add genheader as a cmake test when you do? It seems like a check we must not have because the ninja generator is passing all the tests as it is right now.
(0033342)
bamiaux   
2013-06-20 08:42   
Would it be possible to include this patch into cmake 2.8.11.2 ?
It's quite critical when you're using ninja generators
(0033581)
Reid Kleckner   
2013-07-23 09:44   
What's the status of this? One of my teammates hit the same issue I did, and I was wondering if I should send him the patch. Is there something I can do to help land this?
(0033582)
Robert Maynard   
2013-07-23 10:30   
Thanks for reminding me. I have pushed the patch to stage for review and merge. It it still on the board for merging into 2.8.12.
(0033685)
Robert Maynard   
2013-08-08 13:08   
Merged into CMake master and slated for inclusion in 2.8.12
(0035069)
Robert Maynard   
2014-02-10 10:44   
Closing resolved issues that have not been updated in more than 4 months.