summaryrefslogtreecommitdiffstats
path: root/llvm/cmake/modules/LLVMInstallSymlink.cmake
blob: 09fed8085c23e27a4a322240b7b094b011c91c1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# We need to execute this script at installation time because the
# DESTDIR environment variable may be unset at configuration time.
# See PR8397.

function(install_symlink name target outdir)
  set(DESTDIR $ENV{DESTDIR})
  if(CMAKE_HOST_UNIX)
    set(LINK_OR_COPY create_symlink)
  else()
    set(LINK_OR_COPY copy)
  endif()

  set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/")

  message(STATUS "Creating ${name}")

  execute_process(
    COMMAND "${CMAKE_COMMAND}" -E ${LINK_OR_COPY} "${target}" "${name}"
    WORKING_DIRECTORY "${bindir}")

endfunction()
OpenPOWER on IntegriCloud