<div dir="ltr">Hi all-<div><br></div><div>I'm building an executable using the standard command:</div><div><br></div><div>add_executable(MyExe a.c b.c)</div><div><br></div><div>I'm adjusting the CMAKE_EXE_LINKER_FLAGS to emit a mapfile, and it works.</div>
<div><br></div><div>If I delete the mapfile, though, performing an incremental build doesn't regenerate the mapfile. This makes sense, since I haven't expressed to cmake that the mapfile depends on MyExe. In the above scenario, the MyExe.map isn't even a target, so cmake doesn't even know it exists.</div>
<div><br></div><div>I've tried creating a custom target, but I can't create a custom command that regenerates the mapfile, since it comes from add_executable. I then tried to use add_dependencies(), but that seems to only influence the build order.</div>
<div><br></div><div>I could explicitly re-run the linker as a custom command that builds a custom target, but that seems wasteful since linking does take a bit of time.</div><div><br></div><div>It almost seems like I need some way to tell add_executable that there are more outputs than just the executable image. Is there a way to do this?</div>
<div><br></div><div>If anybody could point me in the right direction, I'd appreciate it! Thanks in advance for reading.</div><div><br></div><div>Best,</div><div>Charles</div><div><br></div></div>