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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -