summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/warpx/2626.patch
blob: 699744b89df3c2920a957cd6ef8d116b4b187182 (plain) (blame)
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
From 9785e706229622626133c4b03c7abd004f62023f Mon Sep 17 00:00:00 2001
From: Axel Huebl <axel.huebl@plasma.ninja>
Date: Sat, 4 Dec 2021 15:28:13 -0800
Subject: [PATCH] Fix: Installed Symlink LIB

The latest patch to these routines broke our library alias in installs.

By default, this variable is relative and needs the prefix appended.
In some cases, e.g., if externally set, it can already be absolute. In that
case, we skip adding the prefix.
---
 CMakeLists.txt | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 04092ba962..a549546ab9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -343,9 +343,14 @@ if(WarpX_LIB)
     else()
         set(mod_ext "so")
     endif()
+    if(IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR})
+        set(ABS_INSTALL_LIB_DIR ${CMAKE_INSTALL_LIBDIR})
+    else()
+        set(ABS_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
+    endif()
     install(CODE "file(CREATE_LINK
         $<TARGET_FILE_NAME:shared>
-        ${CMAKE_INSTALL_LIBDIR}/libwarpx.${lib_suffix}.${mod_ext}
+        ${ABS_INSTALL_LIB_DIR}/libwarpx.${lib_suffix}.${mod_ext}
         COPY_ON_ERROR SYMBOLIC)")
 endif()