File: InstallSymbolicLink.cmake

package info (click to toggle)
astroidmail 0.16%2B20240629-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,136 kB
  • sloc: cpp: 21,133; ansic: 1,619; python: 93; sh: 73; makefile: 11
file content (13 lines) | stat: -rw-r--r-- 621 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
# shamelessly inspired by https://github.com/bro/cmake/blob/master/InstallSymlink.cmake
macro(install_symlink filepath sympath)
  get_filename_component(symdir ${sympath} DIRECTORY)
  install(DIRECTORY DESTINATION ${symdir})
  install(CODE "
     if (\"\$ENV{DESTDIR}\" STREQUAL \"\")
        execute_process(COMMAND \"${CMAKE_COMMAND}\" -E create_symlink ${filepath} ${sympath})
     else ()
        execute_process(COMMAND \"${CMAKE_COMMAND}\" -E create_symlink ${filepath} \$ENV{DESTDIR}/${sympath})
     endif ()
   ")
  install(CODE "message(\"-- Symlinking: ${sympath} -> ${filepath}\")")
endmacro(install_symlink)