MantisBT - CMake
View Issue Details
0015992CMakeCMakepublic2016-02-27 00:112016-06-10 14:31
Rodger Combs 
Gregor Jasny 
normalminoralways
closedmoved 
CMake 3.4.3 
 
0015992: Xcode generator's ReRunCMake.make fails if dependencies have been deleted
Currently, if a file that a CMake script previously had a dependency on is deleted, the Xcode generator's ReRunCMake.make Makefile will fail with a "no rule to make target <…>" error. This happens pretty frequently if you have a CMake script that reads the ref file for your current git branch and you delete branches regularly, and can also happen if you make other build system changes.

This can be solved by wrapping each item in the list with `$(wildcard <path>)`, which effectively makes the dependencies optional.
No tags attached.
Issue History
2016-02-27 00:11Rodger CombsNew Issue
2016-02-27 14:12Gregor JasnyAssigned To => Gregor Jasny
2016-02-27 14:12Gregor JasnyStatusnew => assigned
2016-02-28 11:36Gregor JasnyNote Added: 0040569
2016-02-28 11:37Gregor JasnyNote Added: 0040570
2016-02-29 03:32Gregor JasnyNote Added: 0040574
2016-02-29 03:37Gregor JasnyNote Added: 0040575
2016-02-29 04:04Rodger CombsNote Added: 0040576
2016-03-06 12:25Gregor JasnyNote Added: 0040598
2016-03-09 14:35Gregor JasnyNote Added: 0040657
2016-06-10 14:29Kitware RobotNote Added: 0042946
2016-06-10 14:29Kitware RobotStatusassigned => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0040569)
Gregor Jasny   
2016-02-28 11:36   
I pushed the xcode-regenerate-on-deleted-files into next.
(0040570)
Gregor Jasny   
2016-02-28 11:37   
Rodger: Thanks for the helpful hint about the wildcard function
(0040574)
Gregor Jasny   
2016-02-29 03:32   
Had to revert the change because $(wildcard ) cannot properly handle white spaces in paths:

Example:
before: file\ name.txt
    @echo Re-generating $@
    @touch $@

after: $(wildcard file\ name.txt)
    @echo Re-generating $@
    @touch $@


Any ideas?
(0040575)
Gregor Jasny   
2016-02-29 03:37   
I could think of of re-writing the whole up-to-date check in POSIX Shell instead of make.
(0040576)
Rodger Combs   
2016-02-29 04:04   
This isn't pretty, since Make generally doesn't support spaces in filenames, but I got a hack to work:

empty:=
space:= $(empty) $(empty)
spaceplus:= $(empty)\ $(empty)
TARGETS += $(subst $(space),$(spaceplus),$(wildcard file\ name.txt))

define RULE
after: $(TARGETS)
    @echo Re-generating $$@ from $$<
    @touch $$@
endef

$(eval $(RULE))
(0040598)
Gregor Jasny   
2016-03-06 12:25   
Thanks for the pretty helpful example code. Why do we need the extra indirection via the evaluated RULE? If I just keep the TARGETS += magic it seems to work, too. Am I missing something?
(0040657)
Gregor Jasny   
2016-03-09 14:35   
Next attempt is merged into next.
(0042946)
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.