[CMake] Wanted : Macro to copy files if touched

John Biddiscombe biddisco at cscs.ch
Fri Jan 13 13:40:53 EST 2006


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

Excellent, this is exactly what I wanted
> 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
>   
No. I didn't want to create custom rules. The one above is just what I 
was looking for. Concise and simple. thanks very much

JB


> 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-----
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>   


-- 
John Biddiscombe,                            email:biddisco @ cscs.ch
http://www.cscs.ch/about/BJohn.php
CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82




More information about the CMake mailing list