MantisBT - CMake
View Issue Details
0013938CMakeCMakepublic2013-02-20 11:032016-06-10 14:31
tasptz 
Kitware Robot 
normalmajoralways
closedmoved 
LinuxUbuntu12.04
CMake 2.8.10.2 
 
0013938: Incomplete header dependencies generated
I constructed a minimal example which reproduces the issue.
The include tree is:

main.cpp -> a/a.h -> x.h (a.h includes x.h without path and x.h is in a/)
        \-> c/c.h -> x.h (c.h includes x.h without path and x.h is in c/)

Now cmake detects the dependency only for one of the two x.h!

Note:
I even added all files to the executable
add_executable(main main.cpp a/a.h a/x.h c/c.h c/x.h)
1. Compile the project.
 * project build must be successful!
2. Change a/x.h and check if the change is picked up by the build system
3. Change c/x.h and check if the change is picked up by the build system

Either step 2 or step 3 should fail!
I ran the following command in the build directory:

$ rgrep "x.h" *
CMakeFiles/main.dir/depend.make:CMakeFiles/main.dir/main.cpp.o: /home/poenitz/Desktop/bugreport/src/a/x.h
CMakeFiles/main.dir/CXX.includecache:x.h
CMakeFiles/main.dir/CXX.includecache:/removed/bugreport/src/a/x.h
CMakeFiles/main.dir/CXX.includecache:/removed/bugreport/src/a/x.h
CMakeFiles/main.dir/CXX.includecache:x.h
CMakeFiles/main.dir/CXX.includecache:/removed/bugreport/src/c/x.h
CMakeFiles/main.dir/depend.internal: /removed/bugreport/src/a/x.h
No tags attached.
zip bugreport.zip (1,530) 2013-02-20 11:03
https://public.kitware.com/Bug/file/4649/bugreport.zip
Issue History
2013-02-20 11:03tasptzNew Issue
2013-02-20 11:03tasptzFile Added: bugreport.zip
2013-02-20 12:04Rolf Eike BeerNote Added: 0032358
2013-02-20 12:21tasptzNote Added: 0032359
2016-06-10 14:28Kitware RobotNote Added: 0042229
2016-06-10 14:28Kitware RobotStatusnew => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:28Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0032358)
Rolf Eike Beer   
2013-02-20 12:04   
Can you try to #include "./x.h" in both places and see if that helps?

Sadly the C/C++ standards do not say that "" includes should look in the local directory first. This is insane, but sadly the truth. E.g. MSVC compilers handle <> and "" includes exactly the same AFAIK.
(0032359)
tasptz   
2013-02-20 12:21   
No it does not help.
Writing full project paths (a/x.h and c/x.h) resolves the issue.

But isn't it irrelevant?
I think that from a C++ point of view there is no collision here and building it works just fine.

Isn't the only problem that cmake somehow overwrites one dependency because the file names are equal?
(0042229)
Kitware Robot   
2016-06-10 14:28   
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.