[CMake] Adding non-source file dependency to Executable

Alexander Neundorf a.neundorf-work at gmx.net
Thu Oct 2 17:49:40 EDT 2008


On Wednesday 24 September 2008, Corrin Meyer wrote:
> This is probably a really noob question...
>
> I am using CMake in a cross-compiler environment (which seems to be
> working really well) and am using custom linker scripts for our
> embedded target.  How do I get the built executable to depend on the
> linker script?  I have tried 'add_depedencies',
> 'set_source_files_properties( ... PROPERTIES OBJECT_DEPENDS ... )',

This should work.
I guess you want the executable be rebuilt if the linker script file changes ?
Try the attached example, it works here. "abc" is just an empty file which 
does nothing, but if I "touch" it, main.o is rebuilt.
main.c can be just "int main() {return 0;}"
Works here both with 2.4 and 2.6.

Alex
-------------- next part --------------
set_source_files_properties(main.c PROPERTIES OBJECT_DEPENDS ${CMAKE_SOURCE_DIR}/abc)
add_executable(hello main.c)


More information about the CMake mailing list