From cfadf26ff2518fac71d44c909bd75357feb060e1 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Mon, 6 Dec 2021 10:13:22 -0800 Subject: [PATCH] Fix: Installed Symlink LIB (#2626) 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 04092ba962d..a549546ab90 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 $ - ${CMAKE_INSTALL_LIBDIR}/libwarpx.${lib_suffix}.${mod_ext} + ${ABS_INSTALL_LIB_DIR}/libwarpx.${lib_suffix}.${mod_ext} COPY_ON_ERROR SYMBOLIC)") endif()