[CMake] external link dependency, non-library

SK sk at metrokings.com
Tue Sep 7 15:04:40 EDT 2010


Hello,

I have an external build process that produces a linker script that I
must use in my CMake project.  I must leave the external build as-is.
I'm using gcc in Linux.

I must relink my application built with CMake if the linker script
changes.  I'm trying to do this in a simple macro and it's not
working.  I do not see a first class way to specify arbitrary link
dependencies, so I'm setting the dependency indirectly to the
application sources.

# setup link dependencies for _app_name
MACRO( DEPEND_ON_LD _app_name)
GET_TARGET_PROPERTY( _srcs ${_app_name} SOURCES )
SET_SOURCE_FILES_PROPERTIES( ${_srcs} PROPERTIES OBJECT_DEPENDS
/full/path/to/linker_script.ld )
ENDMACRO()

If I touch the linker script file, my app does not relink.

Any help is very much appreciated!  Perhaps there is a cleaner way to do this?

Thanks,
-steve


More information about the CMake mailing list