So I need to copy the output *.so from a target to an arbitrary
directory outside the CMAKE_BINARY_DIR. I tried doing this as a post
build event using generator expressions:

add_custom_command(
    TARGET ${target} POST_BUILD VERBATIM
    COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:${target}>" ${dir}
)

This fails because I'm running it outside of the directory where
${target} is defined:

CMake Error at Core/CMake/third-party.cmake:86 (add_custom_command):
  TARGET 'MagickCore' was not created in this directory.


How can I do this without moving my add_custom_command() to the same
directory that created the target? I need to add all the custom
commands at the end of generation because it depends on certain global
properties which are not completely done being set until the very end.
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to