Copying directory from source tree to binary tree. For example: How to copy www to bin folder.
work
├─bin
└─src
├─doing
│ └─www
├─include
└─lib
Thanks.
Copying directory from source tree to binary tree. For example: How to copy www to bin folder.
work
├─bin
└─src
├─doing
│ └─www
├─include
└─lib
Thanks.
As nobody has mentioned
cmake -E copy_directory
as a custom target, here's what I've used:Use execute_process and call cmake -E. If you want a deep copy, you can use the
copy_directory
command. Even better, you could create asymlink
(if your platform supports it) with the create_symlink command. The latter can be achieved like this:From: http://www.cmake.org/pipermail/cmake/2009-March/028299.html
Thank! That is really helpful advice to use bunch of add_custom_target and add_custom_command. I wrote the following function to use everywhere in my projects. Is also specifies the installation rule. I use it primarily to export interface header files.
Usage looks like this:
Based on the answer from Seth Johnson, that's what I wrote for more convenience.
EDIT : That doesn't really work as expected. This one works flawlessly.
With CMake 2.8, use the
file(COPY ...)
command.With older CMake versions, this macro copies files from one directory to another. If you don't want to substitute variables in the copied files, then change the configure_file
@ONLY
argument (for example toCOPYONLY
).Since version 2.8, the file command has a copy argument:
Note that: