From: Magnus Jacobsson Date: Sun, 13 Sep 2020 15:07:44 +0000 (+0200) Subject: Add install of plugin configuration file config6 for CMake builds X-Git-Tag: 2.46.0~20^2^2~60^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3e5c6423bd1b9d3fbe94672f7aa59ad689015fb6;p=graphviz Add install of plugin configuration file config6 for CMake builds --- diff --git a/cmake/configure_plugins.cmake b/cmake/configure_plugins.cmake new file mode 100644 index 000000000..0aea1581b --- /dev/null +++ b/cmake/configure_plugins.cmake @@ -0,0 +1,38 @@ +# Run dot -c in the staging install directory to create the config6 +# plugin before the final package is created. +# +# This script is called just after the dot executable has been copied +# to the staging install directory. It's a bit tricky to retrieve the +# path to that directory since the CPack variables seems to be +# write-only and none of the CMake internal variables contain the path +# in all circumstances. Below is a description how this is achieved. +# +# For the ZIP CPack generator: +# $ENV{DESTDIR} is empty +# ${CMAKE_INSTALL_PREFIX} is the absolute path to the staging install directory +# +# For the NSIS and DEB CPack generators: +# $ENV{DESTDIR} is the absolute path to the staging install directory +# ${CMAKE_INSTALL_PREFIX} is the installation prefix used on the target system +# +# This means that we can just concatenate $ENV{DESTDIR} and +# ${CMAKE_INSTALL_PREFIX} to get the location of the 'bin' and 'lib' +# directories in the staging install area. +# +# More info: +# https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html#variable:CMAKE_INSTALL_PREFIX +# https://cmake.org/cmake/help/latest/envvar/DESTDIR.html +# https://cmake.org/cmake/help/latest/module/CPack.html#variable:CPACK_INSTALL_SCRIPTS (cannot use for this. Runs too early) +# https://stackoverflow.com/questions/43875499/do-post-processing-after-make-install-in-cmake (no useful answer) + +set(ROOT $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}) + +if (APPLE) + set(ENV{DYLD_LIBRARY_PATH} "${ROOT}/lib") +elseif (UNIX) + set(ENV{LD_LIBRARY_PATH} "${ROOT}/lib") +endif() + +execute_process( + COMMAND ${ROOT}/bin/dot -c +) diff --git a/cmd/dot/CMakeLists.txt b/cmd/dot/CMakeLists.txt index 35927c967..445dbebd1 100644 --- a/cmd/dot/CMakeLists.txt +++ b/cmd/dot/CMakeLists.txt @@ -34,3 +34,7 @@ install( FILES dot.1 osage.1 patchwork.1 DESTINATION ${MAN_INSTALL_DIR} ) + +install( + SCRIPT ${TOP_SOURCE_DIR}/cmake/configure_plugins.cmake +)