MantisBT - CMake
View Issue Details
0015003CMakeCMakepublic2014-07-02 16:292016-06-10 14:31
Ryan Curtin 
Kitware Robot 
normalminoralways
closedmoved 
debiansid
CMake 3.0 
 
0015003: depend.make ignores files with the same name
I've attached an interesting project that exposes a bug that is similar (but maybe not identical) to http://public.kitware.com/Bug/view.php?id=9354 [^] . This occurred while working on mlpack ( http://www.mlpack.org/ [^] ) which uses CMake, but I have reduced it to the simplest case I can think of.

We have a test file, 'test.cpp', which includes two files 'a.hpp' and 'b.hpp'. The file 'a.hpp' includes 'a/a.hpp' which in turn includes 'impl.hpp' located in the directory a/. The file 'b.hpp' includes 'b/b.hpp' which in turn includes 'impl.hpp' located in the directory b/.

Then, the CMake configuration just makes a target 'test' that depends on test.cpp, and ideally CMake should figure out all the header dependencies correctly.

However, when CMake is used to configure and build the target, the resulting depend.make file associated with the test target only contains a/impl.hpp and not b/impl.hpp. This means I can make changes to b/impl.hpp and recompile, but CMake does not detect the changes.

Unfortunately I am not enough of a CMake expert to provide a patch, but I thought it would at least be useful to reproduce the issue.
1. unpack attached .tar.gz
2. use CMake to configure it
3. build the test target
4. run ./test, look, the output is complaints
5. modify b/impl.hpp and add vulgarities
6. make test
7. run ./test... no vulgarities!
I tried with both CMake 2.8 and 3.0, so it is tested against the latest stable release of CMake in both the 2.x and 3.x branches.
No tags attached.
related to 0009354closed Brad King wrong C dependency if header file has same name as standard header file 
gz cmake-test.tar.gz (565) 2014-07-02 16:29
https://public.kitware.com/Bug/file/5184/cmake-test.tar.gz
Issue History
2014-07-02 16:29Ryan CurtinNew Issue
2014-07-02 16:29Ryan CurtinFile Added: cmake-test.tar.gz
2014-07-02 16:31Ryan CurtinNote Added: 0036312
2014-07-03 09:22Brad KingRelationship addedrelated to 0009354
2014-07-03 09:23Brad KingNote Added: 0036318
2014-07-03 09:23Brad KingStatusnew => backlog
2016-06-10 14:29Kitware RobotNote Added: 0042578
2016-06-10 14:29Kitware RobotStatusbacklog => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0036312)
Ryan Curtin   
2014-07-02 16:31   
Oops, I wrote "I thought it would at least be useful to reproduce the issue" but I mean "I thought it would at least be useful to report the issue". Please excuse the typo...
(0036318)
Brad King   
2014-07-03 09:23   
Just as in 0009354 comment 0009354:0017053 this is a known limitation and is best worked around by changing the code to not do this.
(0042578)
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.