[CMake] Help with Policy CMP0026 (disallow LOCATION target property)

Paul Smith paul at mad-scientist.net
Sat Jan 3 11:11:41 EST 2015


On Mon, 2014-12-29 at 02:03 +0000, Fraser Hutchison wrote:
> I'd have thought the following replacement would work the same:
> 
>   function(stageobj target dir)
>       add_custom_target(stage_${target} ALL
>           COMMAND "${CMAKE_COMMAND}" -E make_directory "${DESTDIR}/${dir}"
>           COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$<TARGET_FILE:${target}>" "${DESTDIR}/${dir}"
>           COMMENT "Staging ${target} to ${DESTDIR}/${dir}"
>           VERBATIM)
>       add_dependencies(stage_${target} ${target})
>   endfunction()

Sorry for the delayed reply, I was on holiday.

Yes, this will work although it means I get the "Staging ..." message
for every staged file every time I build (even if it doesn't actually
copy unless different); I think that's why I used the other method.

I bit the bullet and changed my rules to build directly into the staging
area rather than copying them afterward.  Since I already went through
the pain I'd just as soon not go back again now :-), so I'm all set I
think.

Thanks all!



More information about the CMake mailing list