[CMake] file not generated with ADD_CUSTOM_COMMAND

Brad King brad.king at kitware.com
Thu Jan 5 13:45:58 EST 2006


Alexander Neundorf wrote:
>>Von: "William A. Hoffman" <billlist at nycap.rr.com> 
>>You were missing the INCLUDE_DIRECTORIES command so the depend 
>>information did not search the correct directory for the file. 
> 
> But generated.h is included  
> #include "generated.h" 
> i.e. not with sharp braces, so the INCLUDE_DIRECTORIES() actually 
> shouldn't matter, should it ? 

Double-quote includes look for the source files in the directory 
containing the source, not in the current working directory of the 
compiler.  For an out-of-source build the directory in which the header 
is generated is not the one containing the source file.  Therefore you 
need to add the include directory explicitly.

CMake used to automatically add the build directory location 
corresponding to the source directory so that double-quote includes 
would appear to be able to get things from the compiler's working 
directory but this was removed in version 2.2 (unless 
CMAKE_BACKWARDS_COMPATIBILITY is set to 2.0 or lower).  The "feature" 
caused too many problems.

-Brad


More information about the CMake mailing list