]> granicus.if.org Git - graphviz/commitdiff
CMake: add 'gv2gxl', 'gxl2dot' symlinks
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 10 Nov 2022 16:11:32 +0000 (08:11 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 11 Nov 2022 15:48:48 +0000 (07:48 -0800)
This replicates a pattern from cmd/dot/CMakeLists.txt for adding multiple
links/copies to the existing `gxl2gv` target.

Gitlab: #1836

CHANGELOG.md
ci/tests.py
cmd/tools/CMakeLists.txt

index d9b0df2396694cbf1696384dcb4c5d2d5302bfcf..665f4e4df2287e293ee44838fbc86d5ce38d2ae6 100644 (file)
@@ -8,8 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ### Added
 
-- The `cluster` and `prune` utilities is now included in the CMake build
-  system. #1836
+- The `cluster`, `dot2gxl`, `gv2gxl`, and `prune` utilities are now included in
+  the CMake build system. #1836
 
 ### Fixed
 
index 530ae02f335bc8bd8461ff7ff7f103ca2a61a879..3dfa6e05d59b599dc0570dccd7cad55883dc8a12 100644 (file)
@@ -99,9 +99,7 @@ def test_existence(binary: str):
 
   tools_not_built_with_cmake = [
     "dot_builtins",
-    "gv2gxl",
     "gvedit",
-    "gxl2dot",
   ]
 
   tools_not_built_with_msbuild = [
index f015a402b410e65ad731851f2038a3580f37aa57..3a3cfd49e96f40cb50e904ad980d8f6312a6d117 100644 (file)
@@ -356,29 +356,36 @@ if(EXPAT_FOUND)
 
   tool_defaults(gxl2gv)
 
-  set(DOT2GXL "${CMAKE_CURRENT_BINARY_DIR}/dot2gxl${CMAKE_EXECUTABLE_SUFFIX}")
-  if(WIN32 OR CYGWIN)
-    # copy instead of symlink to avoid
-    # https://gitlab.com/graphviz/graphviz/-/issues/2123
-    add_custom_command(
-      TARGET gxl2gv
-      POST_BUILD
-      COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:gxl2gv> ${DOT2GXL}
-      COMMENT "Copying gxl2gv to ${DOT2GXL}")
-    install(
-      PROGRAMS ${DOT2GXL}
-      DESTINATION ${BINARY_INSTALL_DIR})
-  else()
-    add_custom_command(
-      TARGET gxl2gv
-      POST_BUILD
-      COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:gxl2gv>
-        ${DOT2GXL}
-      COMMENT "Linking gxl2gv as ${DOT2GXL}")
-    install(
-      FILES ${DOT2GXL}
-      DESTINATION ${BINARY_INSTALL_DIR})
-  endif()
+  list(APPEND gxl2gv_aliases dot2gxl gv2gxl gxl2dot)
+  foreach(cmd_alias IN LISTS gxl2gv_aliases)
+    set(GXL2GV_COPY
+        "${CMAKE_CURRENT_BINARY_DIR}/${cmd_alias}${CMAKE_EXECUTABLE_SUFFIX}")
+    if(WIN32 OR CYGWIN)
+      # copy instead of symlink to avoid
+      # https://gitlab.com/graphviz/graphviz/-/issues/2123
+      add_custom_command(
+        TARGET gxl2gv
+        POST_BUILD
+        COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:gxl2gv> ${GXL2GV_COPY}
+        COMMENT "Copying gxl2gv to ${GXL2GV_COPY}"
+      )
+      install(
+        PROGRAMS ${GXL2GV_COPY}
+        DESTINATION ${BINARY_INSTALL_DIR}
+      )
+    else()
+      add_custom_command(
+        TARGET gxl2gv
+        POST_BUILD
+        COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:gxl2gv>
+          ${cmd_alias}
+        COMMENT "Linking gxl2gv as ${cmd_alias}")
+      install(
+        FILES ${GXL2GV_COPY}
+        DESTINATION ${BINARY_INSTALL_DIR}
+      )
+    endif()
+  endforeach()
 
 endif()