[CMake] How to copy files to the directory of executable file.

Werner Smekal smekal at iap.tuwien.ac.at
Thu Mar 19 03:06:32 EDT 2009


Hi,

On 19.03.2009, at 02:28, Dancefire wrote:

> Hi,
>
> I'm working on a simple gtkmm program. I use CMake for the makefile  
> generator. I use GtkBuilder to create the window form, so I need a  
> non-executable file, "window.xml", locate at the same directory of  
> executable file which just build.
>
> The directory structure is simple, every files on the top directory.  
> During build, I do following:
>
> mkdir build
> cd build
> cmake ..
> make
>
> The problem is how can I copy ../window.xml to the "build" directory?

use "cmake -E copy", e.g.

   add_custom_command(
     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sfstubs.f
     COMMAND ${CMAKE_COMMAND}
     -E copy ${CMAKE_CURRENT_SOURCE_DIR}/sfstubs.fm4 $ 
{CMAKE_CURRENT_BINARY_DIR}/sfstubs.f
     DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/sfstubs.fm4
   )


Regards,
Werner


>
> _______________________________________________
> 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

--
Dr. Werner Smekal
Institut fuer Allgemeine Physik
Technische Universitaet Wien
Wiedner Hauptstr 8-10
A-1040 Wien
Austria

email: smekal at iap.tuwien.ac.at
web: http://www.iap.tuwien.ac.at/~smekal
phone: +43-(0)1-58801-13463 (office), +43-(0)1-58801-13469 (laboratory)
fax: +43-(0)1-58801-13499



More information about the CMake mailing list