[CMake] Problem of dependencies

Bill Hoffman bill.hoffman at kitware.com
Fri Feb 29 08:20:08 EST 2008


Alexander Neundorf wrote:
> On Wednesday 27 February 2008, Guillaume Damiand wrote:
>> Hello,
>>
>> I have discovered cmake one week ago and I am very impressed by its
>> powerful and facility of using.
>>
>> However, I have a problem concerning dependencies and I have not found
>> any solutions in forums or documentations.
>>
>>
>> I use 3 types of files .hh et .cc (as usual) and .icc for inline
>> fonctions. I have two macros INCLUDE_INLINE and INCLUDE_NON_INLINE which
>> allow, given a compilation option, to include an .icc file into a .hh or
>> a .cc depending if we want to inline fonctions or not.
> 
> cmake already scans the source files for included files.
> In your case the included .icc files are not found ?
> You can check e.g. CMakeFiles/<target>.dir/depend.internal for that.
> If that's the case I think you can adjust some regular expression variable so 
> that your include fioes are also recognized.
> 

The problem is that cmake does not expand macros, it only looks for 
#include lines.  In this case the #include lines are macros, so cmake 
can't figure out what is being included.  A work around that we use in 
kwsys is this:



#include KWSYS_HEADER(ios/iostream)
#include KWSYS_HEADER(ios/fstream)
#include KWSYS_HEADER(ios/sstream)

// Work-around CMake dependency scanning limitation.  This must
// duplicate the above list of headers.
#if 0
# include "SystemTools.hxx.in"
# include "Directory.hxx.in"
# include "kwsys_ios_iostream.h.in"
# include "kwsys_ios_fstream.h.in"
# include "kwsys_ios_sstream.h.in"
#endif

I am thinking we may want to look at a more general fix to this problem. 
   Feel free to create a feature request.

-Bill


More information about the CMake mailing list