Chris Bieneman | 2ec309f | 2015-09-14 23:09:06 +0000 | [diff] [blame] | 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 | |
Chris Bieneman | 26751e1 | 2015-10-16 23:17:13 +0000 | [diff] [blame] | 5 | function(install_symlink name target outdir) |
Shoaib Meenai | cb3923f | 2018-01-09 07:50:18 +0000 | [diff] [blame] | 6 | if(CMAKE_HOST_UNIX) |
Chris Bieneman | 2ec309f | 2015-09-14 23:09:06 +0000 | [diff] [blame] | 7 | set(LINK_OR_COPY create_symlink) |
| 8 | set(DESTDIR $ENV{DESTDIR}) |
| 9 | else() |
| 10 | set(LINK_OR_COPY copy) |
| 11 | endif() |
| 12 | |
Chris Bieneman | 26751e1 | 2015-10-16 23:17:13 +0000 | [diff] [blame] | 13 | set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/") |
Chris Bieneman | 2ec309f | 2015-09-14 23:09:06 +0000 | [diff] [blame] | 14 | |
| 15 | message("Creating ${name}") |
| 16 | |
| 17 | execute_process( |
Chris Bieneman | 26751e1 | 2015-10-16 23:17:13 +0000 | [diff] [blame] | 18 | COMMAND "${CMAKE_COMMAND}" -E ${LINK_OR_COPY} "${target}" "${name}" |
Chris Bieneman | 2ec309f | 2015-09-14 23:09:06 +0000 | [diff] [blame] | 19 | WORKING_DIRECTORY "${bindir}") |
| 20 | |
| 21 | endfunction() |