]> granicus.if.org Git - graphviz/commitdiff
CMake: add a variable substitution step for plugin configuration step
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 30 Jan 2022 23:54:46 +0000 (10:54 +1100)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 3 Feb 2022 06:20:31 +0000 (17:20 +1100)
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

cmake/configure_plugins.cmake.in [moved from cmake/configure_plugins.cmake with 100% similarity]
cmd/dot/CMakeLists.txt

index 6848feace6cb5bfe5a20d5d84298aee0f0b63cf6..88f8e0910635d232053bfdbf917861f7b80b0f0d 100644 (file)
@@ -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()