1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
This is an adapted version of:
From: Benjamin Drung <benjamin.drung@canonical.com>
Date: Thu, 22 Sep 2022 19:52:43 +0200
Subject: Fix rpath for private libraries on Linux
Fixes: https://github.com/audacity/audacity/issues/3289
Forwarded: https://github.com/audacity/audacity/pull/3671
[1] https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling#caveats
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -412,6 +412,7 @@
set( _LIBDIR "${CMAKE_INSTALL_LIBDIR}" )
set( _DATADIR "${CMAKE_INSTALL_DATADIR}" )
set( _PKGLIB "${_LIBDIR}/audacity" )
+set( _PKGMODULE "${_PKGLIB}/modules" )
set( _PKGDATA "${_DATADIR}/audacity/" )
set( _MANDIR "${CMAKE_INSTALL_MANDIR}" )
set( _MODDIR "${_PKGLIB}/modules" )
--- a/cmake-proxies/cmake-modules/AudacityFunctions.cmake
+++ b/cmake-proxies/cmake-modules/AudacityFunctions.cmake
@@ -338,6 +338,17 @@
set( "${var}" "${node}" PARENT_SCOPE )
endfunction()
+# Call install(TARGETS...) only on Linux systems (i.e. exclude MacOS and Windows)
+macro( install_target_linux target destination )
+ if( NOT "${CMAKE_GENERATOR}" MATCHES "Xcode|Visual Studio*" AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin" )
+ install( TARGETS "${target}" DESTINATION "${destination}" )
+ endif()
+endmacro()
+
+macro( install_audacity_module target )
+ install_target_linux( "${target}" "${_PKGMODULE}" )
+endmacro()
+
define_property(TARGET PROPERTY AUDACITY_GRAPH_DEPENDENCIES
BRIEF_DOCS
"Propagates information used in generating a target dependency diagram"
@@ -420,6 +431,13 @@
list( APPEND GRAPH_EDGES "\"${TARGET}\" -> \"${IMPORT}\" ${attributes}" )
endforeach()
set( GRAPH_EDGES "${GRAPH_EDGES}" PARENT_SCOPE )
+
+ # Note: Some modules set EXCLUDE_FROM_ALL afterwards to not be installed.
+ # Therefore only install libraries, but not modules here.
+ if( NOT REAL_LIBTYPE STREQUAL "MODULE" )
+ install_target_linux( "${TARGET}" "${_PKGLIB}" )
+ endif()
+
endfunction()
function ( make_interface_alias TARGET REAL_LIBTYTPE )
@@ -487,6 +505,7 @@
PROPERTIES
PREFIX ""
FOLDER "modules" # for IDE organization
+ INSTALL_RPATH "$ORIGIN/.."
)
if( NOT CMAKE_SYSTEM_NAME MATCHES "Windows|Darwin" )
@@ -501,6 +520,7 @@
PROPERTIES
PREFIX ""
FOLDER "libraries" # for IDE organization
+ INSTALL_RPATH "$ORIGIN"
)
if( NOT CMAKE_SYSTEM_NAME MATCHES "Windows|Darwin" )
--- a/modules/mod-script-pipe/CMakeLists.txt
+++ b/modules/mod-script-pipe/CMakeLists.txt
@@ -15,3 +15,4 @@
)
audacity_module( mod-script-pipe "${SOURCES}" "Audacity"
"${DEFINES}" "" )
+install_audacity_module( mod-script-pipe )
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1557,11 +1557,6 @@
RUNTIME
RESOURCE DESTINATION "${_PKGDATA}" )
- install( DIRECTORY "${_DEST}/${_LIBDIR}/"
- DESTINATION "${_LIBDIR}"
- USE_SOURCE_PERMISSIONS
- FILES_MATCHING PATTERN "*.so*" )
-
install( FILES "${_INTDIR}/audacity.desktop"
DESTINATION "${_DATADIR}/applications" )
install( FILES "${topdir}/LICENSE.txt" "${topdir}/README.md"
|