[CMake] Re: [Insight-developers] can cmake generate an error if a variable doesn't exist ?

William A. Hoffman billlist at nycap.rr.com
Fri Jan 13 08:35:35 EST 2006


>
>I have a slightly related issue/wish/problem. 
>I'd like to append files to the OBJECT_DEPENDS property. 
> 
>GET_SOURCE_FILE_PROPERTY(deps main.c OBJECT_DEPENDS) 
> 
>If OBJECT_DEPENDS wasn't set before, deps will be "NOTFOUND" after this 
>call. That's ok but in my case it would be better if it would be empty. 
>Because as it is now I have to do the following: 
> 
>MACRO(ADD_DEP source dep) 
> GET_SOURCE_FILE_PROPERTY(deps ${source} OBJECT_DEPENDS) 
> IF(deps) 
>   SET(deps ${deps} ${dep} )  
> ELSE(deps) 
>   SET(deps ${dep} )  
> ENDIF(deps) 
> SET_SOURCE_FILES_PROPERTIES(${source} PROPERTIES OBJECT_DEPENDS ${deps}) 
>ENDMACRO(ADD_DEP source dep) 
> 
>instead of  
> 
>MACRO(ADD_DEP source dep) 
> GET_SOURCE_FILE_PROPERTY(deps ${source} OBJECT_DEPENDS) 
> SET(deps ${deps} ${dep} )  
> SET_SOURCE_FILES_PROPERTIES(${source} PROPERTIES OBJECT_DEPENDS ${deps}) 
>ENDMACRO(ADD_DEP source dep) 

This is a different issue.   I can not remember why we wanted to make
source file properties default to NOTFOUND.  I guess it was so you could
tell the difference between empty and never set.   

-Bill



More information about the CMake mailing list