[CMake] Dealing with custom command outputs when using clean

Petr Kmoch petr.kmoch at gmail.com
Tue Jan 8 04:45:38 EST 2013


Hi Willy.

I believe the property ADDITIONAL_MAKE_CLEAN_FILES should be set on the
directory which *creates* the file, not the one which contains it on disk.

Petr

On Tue, Jan 8, 2013 at 10:42 AM, Willy Lambert <lambert.willy at gmail.com>wrote:

> Hi all,
>
> When I build my project I use the EXECUTABLE_OUTPUT_PATH to produce my
> binaries. As I also want to split the binaries between the stripped
> stuff and the debug stuff (so basically I have a exe and exe.debug).
> This is done with objcopy, so I use a custom command :
>
>         set( EXEC ${EXECUTABLE_OUTPUT_PATH}/${EXEC_NAME} )
>         set( DBG_INFO "${EXECUTABLE_OUTPUT_PATH}/${EXEC_NAME}.debug" )
>         add_custom_command(TARGET ${EXEC_NAME}
>                 POST_BUILD
>                 COMMAND ${CMAKE_SPIE_OBJECT_COPY} --only-keep-debug
> ${EXEC} ${DBG_INFO}
>                 COMMAND ${CMAKE_SPIE_STRIP} --strip-debug --strip-unneeded
> ${EXEC}
>                 COMMAND ${CMAKE_SPIE_OBJECT_COPY}
> --add-gnu-debuglink=${DBG_INFO} ${EXEC}
>         )
>
> My problem comes when I use the "make clean" command from my cmake
> root dir, because it doesn't clean the custom command output *.debug
> (which is quite natural). So I tried to modify properties to specify
> ADDITIONAL_MAKE_CLEAN_FILES, but this :
>
>         set_property(DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
>                 PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${EXEC_NAME}.debug)
>
> results in :
>
> CMake Error a tXXXXXXX/cle.cmake:42 (set_property):
>   set_property DIRECTORY scope provided but requested directory was not
>   found.  This could be because the directory argument was invalid or, it
> is
>   valid but has not been processed yet.
>
>
> If I'm correct it's due to the EXECUTABLE_OUTPUT_PATH dir management.
>
> My questions are :
> _ is EXECUTABLE_OUTPUT_PATH deprecated ? I read in docs :
> "EXECUTABLE_OUTPUT_PATH: Old executable location variable." (so I
> wonder about the "Old" point)
> _ is my custom command correctly configured regarding the action
> "modifying a compiled exec" ?
> _ did I do something wrong with "make clean" properties ?
>
> Have a nice day !
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130108/f8165c1b/attachment.htm>


More information about the CMake mailing list