[CMake] How to make executable depend on pre-existing controlfile?

Trevor Kellaway tkellaway at asl-electronics.co.uk
Sun Apr 22 17:31:44 EDT 2007


Brandon,

>> 	I'm try to get my link to depend on a pre-existing file 
>> that contains linker segment information "link.prm". 
>> 
>> 	I thought that by just adding this to the executable 
>> dependency list this should work: 
>> 
>> 	        ADD_EXECUTABLE (${THIS_APP} ${THIS_SRC} 
>> ${CMAKE_SOURCE_DIR}/link.prm) 
>> 
>> 	Alas, it seems to have no effect. The generated 
>> "build.make" contains no dependency references for "link.prm". 
>> 
>> 	Is this the correct way of doing this?
>> 
> 
> ADD_EXECUTABLE isn't taking a dependency list.  It's taking a 
> list of source files used to build.  If link.prm has no 
> relevance to the build, I'll wager that it is discarded.  I 
> bet you'll need:
> 
> ADD_EXECUTABLE (${THIS_APP} ${THIS_SRC}) 
> ADD_CUSTOM_TARGET(link_prm DEPENDS 
> ${CMAKE_SOURCE_DIR}/link.prm) ADD_DEPENDENCIES(${THIS_APP} link_prm)

Thanks for your reply, but that still doesn't seem to work.

If I get my build fully built, so nothing runs on a subsequent make,
then a "touch link.prm" doesn't cause a relink.

For the ultimate target "app.elf" in build.make it doesn't seem to
contain a dependency on "link.prm".

Any ideas, as this has stumped me, in a regular makefile I'd just add
this to the dependency list.

 - TrevK


More information about the CMake mailing list