From 88f6e1b332489582f457d17afd6a2a6f6a4f988d Mon Sep 17 00:00:00 2001
From: Mattias Ellert <mattias.ellert@physics.uu.se>
Date: Mon, 1 Jul 2019 08:56:27 +0200
Subject: [PATCH] Install GDB pretty printers with correct filename when using
soversion
The name of the pretty printer script must match the name of the
binary, not a symlink. When soversion is used the unversioned .so file
is a symlink to the versioned library file.
---
build/CMakeLists.txt | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt
index b84481041b..03644b6c00 100644
--- a/build/CMakeLists.txt
+++ b/build/CMakeLists.txt
@@ -20,12 +20,23 @@ ROOT_EXECUTABLE(rmkdepend
)
IF(CMAKE_BUILD_TYPE MATCHES "Debug|RelWithDebInfo")
- file(COPY "gdbPrinters/"
- DESTINATION ${CMAKE_BINARY_DIR}/lib
- FILES_MATCHING PATTERN "*-gdb.py")
+ file(GLOB PRETTY_PRINTERS "gdbPrinters/*.so-gdb.py")
+ set(PRETTY_PRINTER_DESTS)
+ foreach(PRETTY_PRINTER ${PRETTY_PRINTERS})
+ get_filename_component(PRETTY_PRINTER_DEST ${PRETTY_PRINTER} NAME)
+ if(soversion)
+ string(REPLACE ".so-gdb.py" ".so.${ROOT_VERSION}-gdb.py"
+ PRETTY_PRINTER_DEST ${PRETTY_PRINTER_DEST})
+ endif(soversion)
+ set(PRETTY_PRINTER_DEST ${CMAKE_BINARY_DIR}/lib/${PRETTY_PRINTER_DEST})
+ add_custom_command(OUTPUT ${PRETTY_PRINTER_DEST}
+ COMMAND ${CMAKE_COMMAND} -E copy ${PRETTY_PRINTER} ${PRETTY_PRINTER_DEST}
+ DEPENDS ${PRETTY_PRINTER})
+ list(APPEND PRETTY_PRINTER_DESTS ${PRETTY_PRINTER_DEST})
+ endforeach()
+ add_custom_target(copy_pretty_printers ALL DEPENDS ${PRETTY_PRINTER_DESTS})
- file(GLOB PRETTY_PRINTERS "gdbPrinters/*-gdb.py")
- install(FILES ${PRETTY_PRINTERS}
- DESTINATION lib
+ install(FILES ${PRETTY_PRINTER_DESTS}
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}
CONFIGURATIONS Debug RelWithDebInfo)
ENDIF()
--
2.21.0