When I was investigating similar problem, I found alternative approach at <a href="http://code.google.com/p/dynamorio/source/browse/trunk/CMakeLists.txt">http://code.google.com/p/dynamorio/source/browse/trunk/CMakeLists.txt</a>.<br>
<br>The thing is to change linker rules, to something like this:<br> set(CMAKE_C_CREATE_SHARED_LIBRARY<br> # standard rule<br> "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_C_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"<br>
# now create a .debug copy<br> "${CMAKE_OBJCOPY} --only-keep-debug <TARGET> <TARGET>.debug"<br> # link original to point at .debug copy<br> # directory components are removed, so "../lib/" is fine<br>
"${CMAKE_OBJCOPY} --add-gnu-debuglink=<TARGET>.debug <TARGET>"<br> # Strip all information from target binary.<br> "${CMAKE_STRIP} --strip-debug --discard-all --preserve-dates <TARGET>"<br>
)<br><br>I don't exactly remember benefits from this approach but it kind of works.<br><br>And I agree that functionality like installing debug symbols in install() rules out of box would be quite handy.<br><br>Regards,<br>
Yuri<br><br><div class="gmail_quote">On Sat, Sep 24, 2011 at 4:02 AM, Michael Hertling <span dir="ltr"><<a href="mailto:mhertling@online.de">mhertling@online.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On 09/22/2011 01:24 PM, Rolf Eike Beer wrote:<br>
>> Il 22/09/2011 10.13, Rolf Eike Beer ha scritto:<br>
>>>> Yeah, that's exactly what I had in mind. Any chance that we will see<br>
>>>> this in a future release?<br>
>>> This is usually "find someone who does it and writes tests for it".<br>
>>> Which<br>
>>> then boils down to find someone who has enough knowledge and spare time<br>
>>> to<br>
>>> do or someone that needs it and is willing to pay Kitware for doing it.<br>
><br>
>> Why don't you invoke ${CMAKE_OBJCOPY} as a post build command?<br>
><br>
> That would be a way to _get_ these debug symbol files, but not a clean way<br>
> to _install_ them. And the other reason is that this variable doesn't show<br>
> up in any CMake documentation.<br>
><br>
> Eike<br>
<br>
</div>In order to take up Andrea's suggestion for Lukas' concern:<br>
<br>
CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)<br>
PROJECT(DEBUGINFO C)<br>
SET(CMAKE_VERBOSE_MAKEFILE ON)<br>
FILE(WRITE ${CMAKE_BINARY_DIR}/main.c "int main(void){return 0;}\n")<br>
ADD_EXECUTABLE(main main.c)<br>
FIND_PROGRAM(OBJCOPY objcopy)<br>
ADD_CUSTOM_COMMAND(TARGET main POST_BUILD<br>
COMMAND ${OBJCOPY} --only-keep-debug<br>
$<TARGET_FILE:main> ${CMAKE_BINARY_DIR}/main.dbg<br>
COMMAND ${OBJCOPY} --strip-debug<br>
$<TARGET_FILE:main><br>
COMMAND ${OBJCOPY} --add-gnu-debuglink=main.dbg<br>
$<TARGET_FILE:main><br>
)<br>
INSTALL(TARGETS main RUNTIME DESTINATION bin)<br>
INSTALL(FILES ${CMAKE_BINARY_DIR}/main.dbg DESTINATION bin)<br>
<br>
This exemplary project simply follows objcopy's manpage<br>
w.r.t. the --only-keep-debug switch and works on *nix.<br>
Does it not work for you, or is it not clean enough?<br>
<br>
Regards,<br>
<br>
Michael<br>
<font color="#888888">--<br>
</font><div><div></div><div class="h5"><br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</div></div></blockquote></div><br>