[CMake] OBJECT_DEPENDS problem

Alexander Neundorf a.neundorf-work at gmx.net
Wed Oct 27 17:15:06 EDT 2004


> Alexander Neundorf wrote: 
>  
> > Hi,  
> >   
> > it seems I can add only one dependancy to a source file using  
> > SET_SOURCE_FILES_PROPERTIES()  
> > E.g. after     
> > SET_SOURCE_FILES_PROPERTIES(foo.c PROPERTIES OBJECT_DEPENDS test1.c)  
> > SET_SOURCE_FILES_PROPERTIES(foo.c PROPERTIES OBJECT_DEPENDS test2.c)  
> >   
> > After this foo.c only depends on test2.c but not on test1.c, so it 
seems 
> > this simply gets overwritten.  
> > Any ideas how to solve this problem ?  
>  
> List all the dependencies as one value: 
>  
> SET(foo_c_deps test1.c test2.c) 
> SET_SOURCE_FILES_PROPERTIES( 
>    foo.c PROPERTIES OBJECT_DEPENDS "${foo_c_deps}") 
>  
> Note the double quotes are used to keep the arguments from getting  
> separated. 
 
Yes, works here :-) 
 
The following macro helps if you need to add deps from different places: 
 
MACRO(ADD_FILE_DEPENDANCY file) 
   SET(${file}_deps ${${file}_deps} ${ARGN}) 
   SET_SOURCE_FILES_PROPERTIES( ${file} 
      PROPERTIES OBJECT_DEPENDS "${${file}_deps}" ) 
ENDMACRO(ADD_FILE_DEPENDANCY) 
 
ADD_FILE_DEPENDANCY(foo.cpp test1.cpp test2.cpp) 
 
and somewhere else: 
 
ADD_FILE_DEPENDANCY(foo.cpp moc_foo.cpp) 
 
and then foo.cpp depends on all 3 files :-) 
 
Bye 
Alex 
 

-- 
Geschenkt: 3 Monate GMX ProMail + 3 Ausgaben der TV Movie mit DVD
++++ Jetzt anmelden und testen http://www.gmx.net/de/go/mail ++++



More information about the CMake mailing list