[CMake] Wanted : Macro to copy files if touched
Filipe Sousa
filipe at ipb.pt
Fri Jan 13 11:09:23 EST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
John Biddiscombe wrote:
> Thanks,
>
> I've never used cmake -E - how does one call this from inside CMake
> script. Are you implying that I simply create a custom rule and use
> cmake -E as the command for the copy?
You can use a custom rule or define a macro to handle file copy:
MACRO(COPY_IF_DIFFERENT source dest
EXEC_PROGRAM(
${CMAKE_COMMAND}
ARGS -E copy_if_different ${source} ${dest})
ENDMACRO(MACRO(COPY_IF_DIFFERENT)
use COPY_IF_DIFFERENT with FOREACH
The files are copied when CMakeLists.txt is processed. If you need the
files to be copied when a specific target is built use a custom rule
ADD_CUSTOM_COMMAND(
TARGET ${target}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different ${source} ${dest}
)
PRE_BUILD - run before all other dependencies
PRE_LINK - run after other dependencies
POST_BUILD - run after the target has been built
- --
Filipe Sousa
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
iD8DBQFDx9CzbQdNYqwwwCwRAjskAKCAsqPaiiHmRaomFUQKqN/gRtCLXgCcDAcz
wz54qtsNvX8f3qujdJ1221Q=
=5ZIg
-----END PGP SIGNATURE-----
More information about the CMake
mailing list