[Cmake] Symbolic links
Andy Cedilnik
andy.cedilnik at kitware.com
Mon, 08 Mar 2004 08:37:21 -0500
Hi Dragan,
Two options:
1. Use EXEC_PROGRAM:
IF(UNIX)
FOREACH(file ${symlinks})
EXEC_PROGRAM(/bin/ln
ARGS -s "${srcpath}/${file}" "${destpath}/${file}")
ENDFOREACH(file)
ENDIF(UNIX)
2. Or using custom commands:
IF(UNIX)
SET(symfiles)
FOREACH(file ${symlinks})
ADD_CUSTOM_COMMAND(
OUTPUT "${destpath}/${file}"
DEPENDS "${srcpath}/${file}"
COMMAND /bin/ln
ARGS -s "${srcpath}/${file}" "${destpath}/${file}"
COMMENT "Symlink")
SET(symfiles ${symfiles} "${destpath}/${file}")
ENDFOREACH(file)
ADD_CUSTOM_TARGET(CreateSymlinks ALL DEPENDS ${symfiles})
ENDIF(UNIX)
The difference, the first one will create symlinks as a part of CMake
stage, while the second one as a part of build stage.
Andy
On Mon, 2004-03-08 at 00:14, Dragan Tubic wrote:
> Hello,
>
> For my project I need to install a shared library and create a hundred or so
> symbolic links to it. Is there a way to do so with CMake?