1# We need to execute this script at installation time because the 2# DESTDIR environment variable may be unset at configuration time. 3# See PR8397. 4 5include(GNUInstallDirs) 6 7function(install_symlink name target outdir) 8 set(DESTDIR $ENV{DESTDIR}) 9 if(NOT IS_ABSOLUTE "${outdir}") 10 set(outdir "${CMAKE_INSTALL_PREFIX}/${outdir}") 11 endif() 12 set(outdir "${DESTDIR}${outdir}") 13 14 message(STATUS "Creating ${name}") 15 16 execute_process( 17 COMMAND "${CMAKE_COMMAND}" -E create_symlink "${target}" "${name}" 18 WORKING_DIRECTORY "${outdir}" ERROR_VARIABLE has_err) 19 if(CMAKE_HOST_WIN32 AND has_err) 20 execute_process( 21 COMMAND "${CMAKE_COMMAND}" -E copy "${target}" "${name}" 22 WORKING_DIRECTORY "${outdir}") 23 endif() 24 25endfunction() 26