From: Matthew Fernandez Date: Sun, 30 Jan 2022 23:54:46 +0000 (+1100) Subject: CMake: add a variable substitution step for plugin configuration step X-Git-Tag: 3.0.0~46^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=067088cb6850bd6a6f23d4c5ec8165c89cc15695;p=graphviz CMake: add a variable substitution step for plugin configuration step This CMake script hard codes some library paths in a way that thwarts user/system preferences (#1973). Attempts to solve this by falling back on standard CMake mechanisms have been unsuccessful because an install script like this runs in an isolated environment where it (correctly) does not have access to the configuration from the build environment. To resolve this we need a way to pass the install script parameters/arguments from the build context. Introducing a level of indirection here gives us such a mechanism. This change by itself does nothing. However an upcoming change will take advantage of the `@…@` substitution mechanism enabled by this change. Note that the word “configure” in these files is used to refer to two distinct mechanisms: 1. The CMake `configure_file` command does something analogous to Autotools’ variable substitution during `./configure`. 2. The Graphviz `dot -c …` configure step registers installed Graphviz plugins. Gitlab: #1973 --- diff --git a/cmake/configure_plugins.cmake b/cmake/configure_plugins.cmake.in similarity index 100% rename from cmake/configure_plugins.cmake rename to cmake/configure_plugins.cmake.in diff --git a/cmd/dot/CMakeLists.txt b/cmd/dot/CMakeLists.txt index 6848feace..88f8e0910 100644 --- a/cmd/dot/CMakeLists.txt +++ b/cmd/dot/CMakeLists.txt @@ -121,7 +121,8 @@ else() endif() if(NOT CMAKE_CROSSCOMPILING) - install( - SCRIPT ../../cmake/configure_plugins.cmake - ) + configure_file( + ../../cmake/configure_plugins.cmake.in configure_plugins.cmake @ONLY) + + install(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/configure_plugins.cmake) endif()