[CMake] Fwd: Re: Compiler debug file, howto remove in clean?
Michael Hertling
mhertling at online.de
Tue Dec 13 10:40:54 EST 2011
On 12/13/2011 04:04 PM, Totte Karlsson wrote:
> not sure if the following was sent to the newsgroup?
Wasn't. ;-)
> Sorry if posting double..
Only to me. ;)
>>> set_property(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
>>> ${RUNTIME_OUTPUT_DIRECTORY}/${target}.tds
>>> )
>>>
>>
>> Is your RUNTIME_OUTPUT_DIRECTORY variable set up correctly?
>
> In the top Cmake file I have
> set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bins)
> set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
> Not sure if that is best practice? I'm a cmake beginner
Don't use EXECUTABLE_OUTPUT_PATH, it's obsolete. With regard to
the RUNTIME_OUTPUT_DIRECTORY variable, refer to David's reply.
Regards,
Michael
> Do you
>> perhaps mean the target property of this name instead, and what's
>> the value of your "target" variable?
>
> In the 'target' cmake file, where the target is an application or a dll, it
> looks something like (for an application 'read_from_file'):
>
> set(target read_from_file)
> add_executable(${target} main.cpp)
>
> #MTK libraries
> target_link_libraries (${target} mtkCommon)
> ...
> #VTK libraries
> target_link_libraries(${target} vtkCommon)
> ....
> ADD_CUSTOM_COMMAND(
> TARGET ${target} POST_BUILD
> COMMAND echo ${target} and ${EXECUTABLE_OUTPUT_PATH}
> COMMAND ${CMAKE_COMMAND} -E copy_if_different
> ${CMAKE_CURRENT_SOURCE_DIR}/ball.mtk ${EXECUTABLE_OUTPUT_PATH}
> COMMAND ${CMAKE_COMMAND} -E copy_if_different
> ${CMAKE_CURRENT_SOURCE_DIR}/Alanine.mtk ${EXECUTABLE_OUTPUT_PATH}
> )
>
> set_property(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
> ${EXECUTABLE_OUTPUT_PATH}/ball.mtk
> ${EXECUTABLE_OUTPUT_PATH}/Alanine.mtk
> ${RUNTIME_OUTPUT_DIRECTORY}/${target}.tds
> )
>
> #then comes installs, omitted...
> install (TARGETS ${target} DESTINATION bins)
> ...
>
> In the set_property command, the cleaning works for the text files, ball and
> Alanine.mtk. Interestingly, if I change it to
> ${EXCECUTABLE_PATH}/${target}.tds
>
> So I guess the RUNTIME_OUTPUT_DIRECTORY variable is not set correctly? I thought
> I read somewhere it is setup when the CMAKE_RUNTIME_OUTPUT_DIRECTORY is setup?
>
> Any feedback appreciated!
> totte
More information about the CMake
mailing list