[CMake] Telling cmake that .map files depend on linking?

Charles Nicholson charles.nicholson at gmail.com
Thu May 8 17:51:54 EDT 2014


Hi all-

I'm building an executable using the standard command:

add_executable(MyExe a.c b.c)

I'm adjusting the CMAKE_EXE_LINKER_FLAGS to emit a mapfile, and it works.

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.

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.

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.

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?

If anybody could point me in the right direction, I'd appreciate it!
 Thanks in advance for reading.

Best,
Charles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140508/c072eb25/attachment-0001.html>


More information about the CMake mailing list