I have two custom commands, do things for my target.
After linking my application, I need to about 4 commands to do extra processing on my ELF file.
For me this is a ‘boiler plate’ that occurs for every ELF we build. I want this in a directory with a bunch of other “boiler plate CMAKE code”.
So in that director/Cmake file – I have
add_custom_command( TARGET
foo.elf POST_BUILD
COMMAND
blah blah blah
COMMAND
blah blah blah
COMMAND
blah blah blah
WORKING_DIRECTORY
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
VERBATIM
)
The problem is that the ELF is defined and created in a different CMAKE file and cmake issues an error:
TARGET 'foo.elf' was not created in this directory'
Why does this need to be created in this CMakeList.txt file? I know the target is created in a different CMakefile in a different directory. so why does it have to be here?
Any idea how to work around this?
Is there a way to tell CMAKE – “this target was built in another CMakefile”?