[CMake] two more problems with dependencies
Brad King
brad.king at kitware.com
Thu Jan 5 15:00:33 EST 2006
Alexander Neundorf wrote:
> I found two more problems with dependencies:
>
> Problem 1) if a file is included like this:
> #include "/some/absolute/path/file.h"
> cmDependsC.cxx doesn't notice that this is an absolute path and prepends
> the current directory nevertheless
That is interesting because the scanner has this code:
// If not a full path, find the file in the include path.
std::string fullName;
if(first || cmSystemTools::FileIsFullPath(current.FileName.c_str()))
{
if(this->FileExistsOrIsGenerated(current.FileName, scanned,
dependencies))
{
fullName = current.FileName;
}
}
else ...
which should check for the full path first. The test case you sent does
not seem to reproduce this problem. See the results below.
> problem 2) let's say main.cpp includes generated.h, and generated.h
> depends on "blah.h", specified via ADD_CUSTOM_COMMAND(... DEPENDS blah.h)
> the rule for generated.h will be:
> generated.h: blah.h
> ...do something...
>
> But the depend.make will only list
> main.cpp: generated.h
> but not
> main.cpp: blah.h
> which it should since generated.h depends on it (not via include, but via
> DEPENDS).
The test case you sent gives
CMakeFiles/hello.dir/main.o: /home/kingb/Temp/cmakegen/main.cpp
CMakeFiles/hello.dir/main.o: /usr/include/stdio.h
CMakeFiles/hello.dir/main.o: generated.h
in depend.make and
generated.h: ../blah.h
in build.make using CMake 2.2 or from CVS today.
This is the correct behavior. Unless generated.h actually includes
blah.h then the main.o file does not depend on it. If blah.h changes
then generated.h will re-generate and then main.o will be recompiled.
Besides, CMake has no way to know that blah.h is a valid C file unless
it is included. For all CMake knows the custom command is depending on
some binary file with information for the custom command's executable.
-Brad
More information about the CMake
mailing list