[CMake] Dealing with custom command outputs when using clean

Willy Lambert lambert.willy at gmail.com
Tue Jan 8 04:53:52 EST 2013


Dear Petr,

Thanks for this instant support :D

The correct line was :
	set_directory_properties(PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
${EXECUTABLE_OUTPUT_PATH}/${EXEC_NAME}.debug)

So you are rigth, the directory is the current one (in this case) and
the target file must be surround by the target output dir. I also used
set_duirectory_properties since I think it's a clear wrapper to
set_property(DIRECTORY .)

2013/1/8 Petr Kmoch <petr.kmoch at gmail.com>:
> 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
>
>


More information about the CMake mailing list