Have you tried the CMake variables LIBRARY_OUTPUT_PATH and
EXECUTABLE_OUTPUT_PATH? I¹ve been using them to accomplish much the same
thing.


Parag Chandra
Software Engineer, Mobile Team
Mobile: +1.919.824.1410

 <https://ionic.com>

Ionic Security Inc.
1170 Peachtree St. NE STE 2285, Atlanta, GA 30309











On 12/23/14, 4:06 PM, "Paul Smith" <p...@mad-scientist.net> wrote:

>Hi all.  I need a pointer or two.
>
>In my environment I need to have my executables and binaries copied to
>another location; this has to happen as part of the default "all"
>target: it can't be required to run "install" for example (we use the
>"install" rule for a "real" install step, for one thing).
>
>What I was doing with 2.8.12 was creating a custom target "stage_<foo>"
>with a prerequisite of target <foo>, which had a custom command that
>copied <foo>.  To do this I need to run get_property(pth TARGET <foo>
>PROPERTY LOCATION) so I know where the target file is living, and then I
>use "cmake -E copy ${pth} ${DESTDIR}" to copy it to the right place.
>
>In 3.x this use is deprecated and I wonder what to do instead.
>
>If I add a POST_BUILD custom command directly to target <foo> which
>copies the file then I can use $<TARGET_FILE:<foo>> in my COMMAND script
>and that works...
>
>Except, if someone deletes the copy of the file without touching
>anything else, it doesn't get recopied (because cmake doesn't know about
>the copy and so doesn't realize something is wrong).
>
>I need this to be recopied because we have a habit of just deleting the
>entire destination directory and re-running the build to make a fresh
>copy without changing anything else.
>
>I've thought about many ways to do this, but I can't seem to get around
>the fact that generator expressions like $<TARGET_FILE...> are only
>available within the commands of the target.
>
>Help?
>Thx!
>
>-- 
>
>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

-- 

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