CMAKE: How to add dependency on linker script for executable -
i have cmake script final executable linked own linker script:
cmake_minimum_required(version 3.1) project(test_app) set(linker_script "linker.ld") set(cmake_exe_linker_flags "${cmake_exe_linker_flags} -t ${linker_script}") add_executable(${project_name}.elf main.cpp startup.cpp )
how make executable dependent on linker script file (trigger linking if linker.ld
changed)?
thanks florian mentioning link_depends
in comments. i'll include full answer reference:
you can add link_depends property executable target, using set_target_properties. add following line after add_executable
command:
set_target_properties(${target_name} properties link_depends ${linker_script})
the first argument set_target_properties
target name, i.e. first argument passed add_executable
.
Comments
Post a Comment