1 # We need to execute this script at installation time because the
2 # DESTDIR environment variable may be unset at configuration time.
5 function(install_symlink name target)
7 set(LINK_OR_COPY create_symlink)
8 set(DESTDIR $ENV{DESTDIR})
10 set(LINK_OR_COPY copy)
13 # CMAKE_EXECUTABLE_SUFFIX is undefined on cmake scripts. See PR9286.
15 set(EXECUTABLE_SUFFIX ".exe")
17 set(EXECUTABLE_SUFFIX "")
20 set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/")
22 message("Creating ${name}")
25 COMMAND "${CMAKE_COMMAND}" -E ${LINK_OR_COPY} "${target}${EXECUTABLE_SUFFIX}" "${name}${EXECUTABLE_SUFFIX}"
26 WORKING_DIRECTORY "${bindir}")