2859ed1bac3bf09d779e5a68872b3bd84148c349
[gentoo.git] /
1 From 09afc227e0880b12a98e18ee8182f89c3a80e3a6 Mon Sep 17 00:00:00 2001
2 From: Dennis Schridde <devurandom@gmx.net>
3 Date: Sat, 15 Dec 2018 23:21:17 +0100
4 Subject: [PATCH] CMakeLists.txt: Respect DESTDIR when creating stransmit
5  symlink
6
7 Fixes: #357
8 ---
9  CMakeLists.txt        | 20 ++++++--------------
10  scripts/haiUtil.cmake |  5 -----
11  2 files changed, 6 insertions(+), 19 deletions(-)
12
13 diff --git a/CMakeLists.txt b/CMakeLists.txt
14 index eb2582c..fe45919 100644
15 --- a/CMakeLists.txt
16 +++ b/CMakeLists.txt
17 @@ -705,28 +705,20 @@ if ( ENABLE_CXX11 )
18         # For backward compatibility with the old name
19         if (SYMLINKABLE)
20                 set (REPLI_COMMAND create_symlink )
21 +               # It appears impossible to get the filename component from the generator
22 +               # expression $<TARGET_FILE:srt-live-transmit>, hence we predict it as:
23 +               set (srt_live_transmit_name srt-live-transmit${CMAKE_EXECUTABLE_SUFFIX})
24         else()
25                 set (REPLI_COMMAND copy)
26 +               set (srt_live_transmit_name $<TARGET_FILE:srt-live-transmit>)
27         endif()
28  
29         set (stransmit_path $<TARGET_FILE_DIR:srt-live-transmit>/stransmit${CMAKE_EXECUTABLE_SUFFIX})
30         add_custom_command(
31                 TARGET srt-live-transmit
32                 POST_BUILD
33 -               COMMAND ${CMAKE_COMMAND} -E ${REPLI_COMMAND} $<TARGET_FILE:srt-live-transmit> ${stransmit_path})
34 -
35 -       if (SYMLINKABLE)
36 -               message(STATUS "BACKWARD COMPATIBLE 'stransmit': will use symbolic link")
37 -               srt_install_symlink(srt-live-transmit ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/stransmit)
38 -       elseif(${CMAKE_MAJOR_VERSION} LESS 3)
39 -               message(FATAL_ERROR "Your system can't install symbolic link to 'stransmit', copy-on-install requires cmake at least 3.0.2")
40 -       else()
41 -               # This installation doesn't work with cmake earlier than 3.0
42 -               # (looxlike cmake 2.8 somehow doesn't have a problem with resolving the $<TARGET_FILE_DIR:...>
43 -               # inside the generated makefile, but does have problem with its own generated cmake_install.cmake :D)
44 -               message(STATUS "BACKWARD COMPATIBLE 'stransmit': will use copying")
45 -               install(PROGRAMS ${stransmit_path} DESTINATION ${CMAKE_INSTALL_BINDIR})
46 -       endif()
47 +               COMMAND ${CMAKE_COMMAND} -E ${REPLI_COMMAND} ${srt_live_transmit_name} ${stransmit_path})
48 +       install(FILES ${stransmit_path} DESTINATION ${CMAKE_INSTALL_BINDIR})
49  
50         srt_add_application(srt-file-transmit ${VIRTUAL_srtsupport})
51  
52 diff --git a/scripts/haiUtil.cmake b/scripts/haiUtil.cmake
53 index 417128d..f60bc11 100644
54 --- a/scripts/haiUtil.cmake
55 +++ b/scripts/haiUtil.cmake
56 @@ -48,5 +48,0 @@ FUNCTION(join_arguments outvar)
57 -macro(srt_install_symlink filepath sympath)
58 -    install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${filepath} ${sympath})")
59 -    install(CODE "message(\"-- Created symlink: ${sympath} -> ${filepath}\")")
60 -endmacro(srt_install_symlink)
61 -
62 -- 
63 2.20.0
64