### Conditional Installation of Graphviz Example Files Source: https://gitlab.com/graphviz/graphviz/-/blob/main/share/examples/CMakeLists.txt Installs Graphviz example files (e.g., .gv files) to the specified destination directory if the WITH_SMYRNA build option is enabled. Ensure the DATA_INSTALL_DIR variable is correctly set. ```cmake if(WITH_SMYRNA) install( FILES 4elt.gv world.gv DESTINATION ${DATA_INSTALL_DIR}/graphviz/examples) endif() ``` -------------------------------- ### CMake Build System Setup Source: https://gitlab.com/graphviz/graphviz/-/blob/main/DEVELOPERS.md Sets a temporary installation prefix, configures the build using CMake, compiles, and installs Graphviz. ```sh # you probably do not want to install your development version of Graphviz over # the top of your system binaries/libraries, so create a temporary directory as # an install destination PREFIX=$(mktemp -d) # configure the build system cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} -B build -S . # compile Graphviz binaries and libraries cmake --build build # install everything to the temporary directory cmake --install build ``` -------------------------------- ### Autotools Build System Setup Source: https://gitlab.com/graphviz/graphviz/-/blob/main/DEVELOPERS.md Generates the configure script, sets a temporary installation prefix, configures the build, compiles, and installs Graphviz using Autotools. ```sh # generate the configure script for setting up the build ./autogen.sh # you probably do not want to install your development version of Graphviz over # the top of your system binaries/libraries, so create a temporary directory as # an install destination PREFIX=$(mktemp -d) # configure the build system ./configure --prefix=${PREFIX} # if this is the first time you are building Graphviz from source, you should # inspect the output of ./configure and make sure it is what you expected # compile Graphviz binaries and libraries make # install everything to the temporary directory make install ``` -------------------------------- ### Install and Compress C# Man Page Source: https://gitlab.com/graphviz/graphviz/-/blob/main/tclpkg/gv/CMakeLists.txt Handles the installation of the C# (Sharp) man page. It compresses the man page using GZIP if available, otherwise installs the uncompressed version. This ensures man pages are correctly packaged and installed. ```cmake if(ENABLE_SHARP) if(GZIP) add_custom_target(man-gv_sharp ALL DEPENDS gv.3sharp.gz COMMENT "gv_sharp man page") add_custom_command( OUTPUT gv.3sharp.gz COMMAND ${GZIP} -9 --no-name --to-stdout gv.3sharp >"${CMAKE_CURRENT_BINARY_DIR}/gv.3sharp.gz" DEPENDS gv.3sharp man-bindings COMMENT "compress gv_sharp man page") install( FILES ${CMAKE_CURRENT_BINARY_DIR}/gv.3sharp.gz DESTINATION ${MAN_INSTALL_DIR}/man3) else() install( FILES ${CMAKE_CURRENT_BINARY_DIR}/gv.3sharp DESTINATION ${MAN_INSTALL_DIR}/man3 ) endif() endif() ``` -------------------------------- ### Install xdot Man Page (GZIP enabled) Source: https://gitlab.com/graphviz/graphviz/-/blob/main/lib/xdot/CMakeLists.txt Conditionally installs the 'xdot.3.gz' man page. If GZIP is enabled, it compresses the man page before installation. Otherwise, it installs the uncompressed version. ```cmake if(GZIP) add_custom_target(man-xdot ALL DEPENDS xdot.3.gz COMMENT "xdot man page") add_custom_command( OUTPUT xdot.3.gz COMMAND ${GZIP} -9 --no-name --to-stdout xdot.3 >"${CMAKE_CURRENT_BINARY_DIR}/xdot.3.gz" MAIN_DEPENDENCY xdot.3 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "compress xdot man page") install( FILES ${CMAKE_CURRENT_BINARY_DIR}/xdot.3.gz DESTINATION ${MAN_INSTALL_DIR}/man3) else() install( FILES xdot.3 DESTINATION ${MAN_INSTALL_DIR}/man3 ) endif() ``` -------------------------------- ### Linux Installation Paths Source: https://gitlab.com/graphviz/graphviz/-/blob/main/CMakeLists.txt Sets standard installation directories for Linux systems using GNUInstallDirs. ```cmake if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") include(GNUInstallDirs) set(BINARY_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}") set(LIBRARY_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") set(HEADER_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/graphviz") set(MAN_INSTALL_DIR "${CMAKE_INSTALL_MANDIR}") set(libdir # cmake-lint: disable=C0103 "${CMAKE_INSTALL_FULL_LIBDIR}") set(includedir # cmake-lint: disable=C0103 "${CMAKE_INSTALL_FULL_INCLUDEDIR}") set(DATA_INSTALL_DIR "${CMAKE_INSTALL_DATAROOTDIR}") else() ``` -------------------------------- ### Install Pack Header File Source: https://gitlab.com/graphviz/graphviz/-/blob/main/lib/pack/CMakeLists.txt Installs the 'pack.h' header file to the specified header installation directory. This makes the library's API accessible to users. ```cmake install( FILES pack.h DESTINATION ${HEADER_INSTALL_DIR} ) ``` -------------------------------- ### Install gv_lua man page (compressed) Source: https://gitlab.com/graphviz/graphviz/-/blob/main/tclpkg/gv/CMakeLists.txt Configures the installation of the gv_lua man page, compressing it with gzip if the GZIP option is enabled. ```cmake if(ENABLE_LUA) if(GZIP) add_custom_target(man-gv_lua ALL DEPENDS gv.3lua.gz COMMENT "gv_lua man page") add_custom_command( OUTPUT gv.3lua.gz COMMAND ${GZIP} -9 --no-name --to-stdout gv.3lua >"${CMAKE_CURRENT_BINARY_DIR}/gv.3lua.gz" DEPENDS gv.3lua man-bindings COMMENT "compress gv_lua man page") install( FILES ${CMAKE_CURRENT_BINARY_DIR}/gv.3lua.gz DESTINATION ${MAN_INSTALL_DIR}/man3) else() install( FILES ${CMAKE_CURRENT_BINARY_DIR}/gv.3lua DESTINATION ${MAN_INSTALL_DIR}/man3 ) endif() endif() endif() ``` -------------------------------- ### Install 'prune' Executable and Libraries Source: https://gitlab.com/graphviz/graphviz/-/blob/main/contrib/prune/CMakeLists.txt Installs the 'prune' executable to the binary destination, and its associated libraries and archives to the library destination. This command ensures the built targets are placed in the correct directories upon installation. ```cmake install( TARGETS prune RUNTIME DESTINATION ${BINARY_INSTALL_DIR} LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR} ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR} ) ``` -------------------------------- ### Install gv_ruby man page (compressed) Source: https://gitlab.com/graphviz/graphviz/-/blob/main/tclpkg/gv/CMakeLists.txt Configures the installation of the gv_ruby man page, compressing it with gzip if the GZIP option is enabled. ```cmake if(ENABLE_RUBY) if(GZIP) add_custom_target( man-gv_ruby ALL DEPENDS gv.3ruby.gz COMMENT "gv_ruby man page" ) add_custom_command( OUTPUT gv.3ruby.gz COMMAND ${GZIP} -9 --no-name --to-stdout gv.3ruby >"${CMAKE_CURRENT_BINARY_DIR}/gv.3ruby.gz" DEPENDS gv.3ruby man-bindings COMMENT "compress gv_ruby man page") install( FILES ${CMAKE_CURRENT_BINARY_DIR}/gv.3ruby.gz DESTINATION ${MAN_INSTALL_DIR}/man3) else() install( FILES ${CMAKE_CURRENT_BINARY_DIR}/gv.3ruby DESTINATION ${MAN_INSTALL_DIR}/man3 ) endif() endif() ``` -------------------------------- ### Install Header Files Source: https://gitlab.com/graphviz/graphviz/-/blob/main/lib/cgraph++/CMakeLists.txt Installs the AGraph.h header file to the specified header installation directory. ```cmake install( FILES AGraph.h DESTINATION ${HEADER_INSTALL_DIR} ) ``` -------------------------------- ### Install Sandbox Executable Source: https://gitlab.com/graphviz/graphviz/-/blob/main/cmd/dot/CMakeLists.txt Installs the 'dot_sandbox' executable with specific file permissions. ```cmake install( FILES dot_sandbox DESTINATION ${BINARY_INSTALL_DIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) ``` -------------------------------- ### Install and Compress Tcl Man Page Source: https://gitlab.com/graphviz/graphviz/-/blob/main/tclpkg/gv/CMakeLists.txt Conditionally installs the Tcl man page. If GZIP is available, it compresses the man page before installation; otherwise, it installs the uncompressed version. This ensures man pages are available in the correct format. ```cmake if(ENABLE_TCL) if(GZIP) add_custom_target(man-gv_tcl ALL DEPENDS gv.3tcl.gz COMMENT "gv_tcl man page") add_custom_command( OUTPUT gv.3tcl.gz COMMAND ${GZIP} -9 --no-name --to-stdout gv.3tcl >"${CMAKE_CURRENT_BINARY_DIR}/gv.3tcl.gz" DEPENDS gv.3tcl man-bindings COMMENT "compress gv_tcl man page") install( FILES ${CMAKE_CURRENT_BINARY_DIR}/gv.3tcl.gz DESTINATION ${MAN_INSTALL_DIR}/man3) else() install( FILES ${CMAKE_CURRENT_BINARY_DIR}/gv.3tcl DESTINATION ${MAN_INSTALL_DIR}/man3 ) endif() endif() ``` -------------------------------- ### Plugin and Pkgconfig Installation Directories Source: https://gitlab.com/graphviz/graphviz/-/blob/main/CMakeLists.txt Defines installation paths for graphviz plugins and pkgconfig files. ```cmake set(PLUGIN_INSTALL_DIR ${LIBRARY_INSTALL_DIR}/graphviz) set(PKGCONFIG_DIR ${LIBRARY_INSTALL_DIR}/pkgconfig) ``` -------------------------------- ### Install 'gvplugin_dot_layout' Library Source: https://gitlab.com/graphviz/graphviz/-/blob/main/plugin/dot_layout/CMakeLists.txt Installs the 'gvplugin_dot_layout' target if 'BUILD_SHARED_LIBS' is enabled. It specifies the runtime, library, and archive destinations for the installed files. ```cmake if(BUILD_SHARED_LIBS) # Installation location of library files install( TARGETS gvplugin_dot_layout RUNTIME DESTINATION ${BINARY_INSTALL_DIR} LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR} ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR} ) endif() ``` -------------------------------- ### Install Uncompressed Man Page Source: https://gitlab.com/graphviz/graphviz/-/blob/main/cmd/edgepaint/CMakeLists.txt Installs the uncompressed man page (edgepaint.1) to the man1 directory if GZIP compression is not enabled. ```cmake install( FILES edgepaint.1 DESTINATION ${MAN_INSTALL_DIR}/man1 ) ``` -------------------------------- ### Install Neato Layout Plugin Library Source: https://gitlab.com/graphviz/graphviz/-/blob/main/plugin/neato_layout/CMakeLists.txt Configures the installation of the `gvplugin_neato_layout` target when building shared libraries. Specifies runtime, library, and archive destinations. ```cmake if(BUILD_SHARED_LIBS) # Installation location of library files install( TARGETS gvplugin_neato_layout RUNTIME DESTINATION ${BINARY_INSTALL_DIR} LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR} ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR} ) endif() ``` -------------------------------- ### Install edgepaint Executable and Libraries Source: https://gitlab.com/graphviz/graphviz/-/blob/main/cmd/edgepaint/CMakeLists.txt Installs the edgepaint executable, runtime files, libraries, and archives to their designated destinations based on build configuration. ```cmake install( TARGETS edgepaint RUNTIME DESTINATION ${BINARY_INSTALL_DIR} LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR} ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR} ) ``` -------------------------------- ### Non-Linux Installation Paths Source: https://gitlab.com/graphviz/graphviz/-/blob/main/CMakeLists.txt Sets default installation directories for non-Linux systems relative to the install prefix. ```cmake else() set(BINARY_INSTALL_DIR bin) set(LIBRARY_INSTALL_DIR lib) set(HEADER_INSTALL_DIR include/graphviz) set(MAN_INSTALL_DIR share/man) set(libdir # cmake-lint: disable=C0103 "${CMAKE_INSTALL_PREFIX}/${LIBRARY_INSTALL_DIR}") set(includedir # cmake-lint: disable=C0103 "${CMAKE_INSTALL_PREFIX}/include") set(DATA_INSTALL_DIR share) endif() ``` -------------------------------- ### Handle Man Page Installation with GZIP Source: https://gitlab.com/graphviz/graphviz/-/blob/main/contrib/prune/CMakeLists.txt Conditionally creates a custom target 'man-prune' that depends on the compressed man page. It uses a custom command to compress the 'prune.1' man page using gzip if the GZIP variable is found. The compressed man page is then installed. ```cmake if(GZIP) add_custom_target(man-prune ALL DEPENDS prune.1.gz COMMENT "prune man page") add_custom_command( OUTPUT prune.1.gz COMMAND ${GZIP} -9 --no-name --to-stdout prune.1 >"${CMAKE_CURRENT_BINARY_DIR}/prune.1.gz" MAIN_DEPENDENCY prune.1 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "compress prune man page") install( FILES ${CMAKE_CURRENT_BINARY_DIR}/prune.1.gz DESTINATION ${MAN_INSTALL_DIR}/man1) else() install( FILES prune.1 DESTINATION ${MAN_INSTALL_DIR}/man1 ) endif() ``` -------------------------------- ### Install Library Target Source: https://gitlab.com/graphviz/graphviz/-/blob/main/tclpkg/tclpathplan/CMakeLists.txt Defines installation rules for the 'tclplan' target. It specifies runtime, library, and archive destinations based on predefined variables. ```cmake install( TARGETS tclplan RUNTIME DESTINATION ${BINARY_INSTALL_DIR} LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}/graphviz/tcl ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR} ) ``` -------------------------------- ### Install Compressed Man Page Source: https://gitlab.com/graphviz/graphviz/-/blob/main/lib/pack/CMakeLists.txt Installs the generated compressed man page 'pack.3.gz' to the man3 destination directory. This is executed when the GZIP variable is true. ```cmake install( FILES ${CMAKE_CURRENT_BINARY_DIR}/pack.3.gz DESTINATION ${MAN_INSTALL_DIR}/man3) else() install( FILES pack.3 DESTINATION ${MAN_INSTALL_DIR}/man3 ) endif() ``` -------------------------------- ### Install xdot Header File Source: https://gitlab.com/graphviz/graphviz/-/blob/main/lib/xdot/CMakeLists.txt Installs the 'xdot.h' header file to the specified destination directory. This makes the library's header available for consumers. ```cmake install( FILES xdot.h DESTINATION ${HEADER_INSTALL_DIR} ) ``` -------------------------------- ### Compress and Install vimdot Man Page Source: https://gitlab.com/graphviz/graphviz/-/blob/main/plugin/xlib/CMakeLists.txt Conditionally compresses the vimdot man page using gzip if the GZIP variable is set. It then installs the compressed man page. If GZIP is not found, the uncompressed man page is installed. ```cmake if(GZIP) add_custom_target(man-vimdot ALL DEPENDS vimdot.1.gz COMMENT "vimdot man page") add_custom_command( OUTPUT vimdot.1.gz COMMAND ${GZIP} -9 --no-name --to-stdout vimdot.1 >"${CMAKE_CURRENT_BINARY_DIR}/vimdot.1.gz" MAIN_DEPENDENCY vimdot.1 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "compress vimdot man page") install( FILES ${CMAKE_CURRENT_BINARY_DIR}/vimdot.1.gz DESTINATION ${MAN_INSTALL_DIR}/man1) else() install( FILES vimdot.1 DESTINATION ${MAN_INSTALL_DIR}/man1 ) endif() ``` -------------------------------- ### Install Library Targets Source: https://gitlab.com/graphviz/graphviz/-/blob/main/lib/cgraph++/CMakeLists.txt Configures the installation of the cgraph++ target, specifying runtime, library, and archive destinations. ```cmake install( TARGETS cgraph++ RUNTIME DESTINATION ${BINARY_INSTALL_DIR} LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR} ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR} ) ``` -------------------------------- ### Install 'gvplugin_vt' Library Source: https://gitlab.com/graphviz/graphviz/-/blob/main/plugin/vt/CMakeLists.txt Installs the 'gvplugin_vt' library to specified runtime, library, and archive destinations if shared libraries are being built. This ensures the plugin is accessible. ```cmake if(BUILD_SHARED_LIBS) # Installation location of library files install( TARGETS gvplugin_vt RUNTIME DESTINATION ${BINARY_INSTALL_DIR} LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR} ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR} ) endif() ``` -------------------------------- ### Compress and Install gdtclft Man Page Source: https://gitlab.com/graphviz/graphviz/-/blob/main/tclpkg/gdtclft/CMakeLists.txt Custom command to compress the gdtclft man page using gzip if the GZIP variable is set, otherwise installs the uncompressed file. ```cmake if(GZIP) add_custom_target(man-gdtclft ALL DEPENDS gdtclft.3tcl.gz COMMENT "gdtclft man page") add_custom_command( OUTPUT gdtclft.3tcl.gz COMMAND ${GZIP} -9 --no-name --to-stdout gdtclft.3tcl >"${CMAKE_CURRENT_BINARY_DIR}/gdtclft.3tcl.gz" MAIN_DEPENDENCY gdtclft.3tcl WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "compress gdtclft man page") install( FILES ${CMAKE_CURRENT_BINARY_DIR}/gdtclft.3tcl.gz DESTINATION ${MAN_INSTALL_DIR}/man3) else() install( FILES gdtclft.3tcl DESTINATION ${MAN_INSTALL_DIR}/man3 ) endif() ``` -------------------------------- ### CMake Dependency and Library Setup Source: https://gitlab.com/graphviz/graphviz/-/blob/main/tests/CMakeLists.txt Finds essential libraries like Catch2, RAPIDXML, and SVGPP, enables testing, and defines a static library 'test_common' with specified source files and include directories. Sets C++ standard to 20. ```cmake find_package(Catch2 3 REQUIRED) find_package(RAPIDXML REQUIRED) find_package(SVGPP REQUIRED) enable_testing() add_library(test_common STATIC graphviz_edge.cpp graphviz_edge.h graphviz_graph.cpp graphviz_graph.h graphviz_node.h graphviz_node.cpp test_utilities.cpp svgpp_context.cpp svgpp_context.h svgpp_document_traverser.cpp svgpp_document_traverser.h svg_analyzer.cpp svg_analyzer.h svg_analyzer_interface.h svg_element.cpp svg_element.h test_edge_node_overlap_utilities.cpp test_edge_node_overlap_utilities.h ../cmd/dot/dot_builtins.cpp ) set_target_properties(test_common PROPERTIES CXX_STANDARD 20) set_target_properties(test_common PROPERTIES CXX_STANDARD_REQUIRED ON) target_include_directories(test_common PRIVATE ../lib ../lib/cgraph++ ) target_include_directories(test_common SYSTEM PRIVATE ${Boost_INCLUDE_DIRS} ${RAPIDXML_INCLUDE_DIRS} ${SVGPP_INCLUDE_DIRS} ) target_link_libraries(test_common PUBLIC gvplugin_core gvplugin_dot_layout gvplugin_gd gvplugin_kitty gvplugin_neato_layout gvplugin_pango gvplugin_vt gvplugin_webp cgraph cgraph++ gvc gvc++ Catch2::Catch2 ) ``` -------------------------------- ### Install gvc++ Target Source: https://gitlab.com/graphviz/graphviz/-/blob/main/lib/gvc++/CMakeLists.txt Installs the gvc++ library and its runtime components to specified destinations. This makes the library available for use in other projects. ```cmake install( TARGETS gvc++ RUNTIME DESTINATION ${BINARY_INSTALL_DIR} LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR} ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR} ) ``` -------------------------------- ### Compress and Install Man Pages (GZIP) Source: https://gitlab.com/graphviz/graphviz/-/blob/main/cmd/dot/CMakeLists.txt Compresses man pages using gzip and installs them into the man1 directory. This block handles 'dot', 'dot_sandbox', 'osage', and 'patchwork' man pages. ```cmake if(GZIP) add_custom_target(man-dot ALL DEPENDS dot.1.gz COMMENT "dot man page") add_custom_command( OUTPUT dot.1.gz COMMAND ${GZIP} -9 --no-name --to-stdout dot.1 >"${CMAKE_CURRENT_BINARY_DIR}/dot.1.gz" MAIN_DEPENDENCY dot.1 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "compress dot man page") install( FILES ${CMAKE_CURRENT_BINARY_DIR}/dot.1.gz DESTINATION ${MAN_INSTALL_DIR}/man1) add_custom_target(man-dot_sandbox ALL DEPENDS dot_sandbox.1.gz COMMENT "dot_sandbox man page") add_custom_command( OUTPUT dot_sandbox.1.gz COMMAND ${GZIP} -9 --no-name --to-stdout dot_sandbox.1 >"${CMAKE_CURRENT_BINARY_DIR}/dot_sandbox.1.gz" MAIN_DEPENDENCY dot_sandbox.1 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "compress dot_sandbox man page") install( FILES ${CMAKE_CURRENT_BINARY_DIR}/dot_sandbox.1.gz DESTINATION ${MAN_INSTALL_DIR}/man1) add_custom_target(man-osage ALL DEPENDS osage.1.gz COMMENT "osage man page") add_custom_command( OUTPUT osage.1.gz COMMAND ${GZIP} -9 --no-name --to-stdout osage.1 >"${CMAKE_CURRENT_BINARY_DIR}/osage.1.gz" MAIN_DEPENDENCY osage.1 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "compress osage man page") install( FILES ${CMAKE_CURRENT_BINARY_DIR}/osage.1.gz DESTINATION ${MAN_INSTALL_DIR}/man1) add_custom_target(man-patchwork ALL DEPENDS patchwork.1.gz COMMENT "patchwork man page") add_custom_command( OUTPUT patchwork.1.gz COMMAND ${GZIP} -9 --no-name --to-stdout patchwork.1 >"${CMAKE_CURRENT_BINARY_DIR}/patchwork.1.gz" MAIN_DEPENDENCY patchwork.1 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "compress patchwork man page") install( FILES ${CMAKE_CURRENT_BINARY_DIR}/patchwork.1.gz DESTINATION ${MAN_INSTALL_DIR}/man1) else() install( FILES dot.1 dot_sandbox.1 osage.1 patchwork.1 DESTINATION ${MAN_INSTALL_DIR}/man1 ) endif() ``` -------------------------------- ### Install Graphviz Executables with Aliases Source: https://gitlab.com/graphviz/graphviz/-/blob/main/cmd/dot/CMakeLists.txt Copies the 'dot' executable to alias names and installs them. This is used on Windows and Cygwin systems. ```cmake foreach(cmd_alias IN LISTS dot_aliases) set(DOTCOPY "${CMAKE_CURRENT_BINARY_DIR}/${cmd_alias}${CMAKE_EXECUTABLE_SUFFIX}") if(WIN32 OR CYGWIN) # Copy dot executable to each alias name then install copies to bindir add_custom_command( TARGET dot POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ ${DOTCOPY} COMMENT "Copying dot to ${DOTCOPY}" ) install( PROGRAMS ${DOTCOPY} DESTINATION ${BINARY_INSTALL_DIR} ) else() # For not-WIN32, install symlinks from dot_aliases -> dot_executable in # bindir. Note: This may be brittle. This builds a symlink from # ./cmd_alias -> ./dot in ${CMAKE_CURRENT_BINARY_DIR}, then installs that # symlink into ${BINARY_INSTALL_DIR}. This presumes # ${CMAKE_CURRENT_BINARY_DIR}/dot is installed to ${BINARY_INSTALL_DIR}/dot. # There is a (small?) risk of dangling symlinks add_custom_command( TARGET dot POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $ ${cmd_alias} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Linking dot as ${cmd_alias}" ) install( FILES ${DOTCOPY} DESTINATION ${BINARY_INSTALL_DIR} ) endif() endforeach() ``` -------------------------------- ### Install xdot Library and Export Targets Source: https://gitlab.com/graphviz/graphviz/-/blob/main/lib/xdot/CMakeLists.txt Installs the 'xdot' target, including runtime, library, and archive files, and exports it under the 'graphvizTargets' configuration for use by other projects. ```cmake install( TARGETS xdot EXPORT graphvizTargets RUNTIME DESTINATION ${BINARY_INSTALL_DIR} LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR} ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR} ) ``` -------------------------------- ### Compare Graphviz Performance Source: https://gitlab.com/graphviz/graphviz/-/blob/main/DEVELOPERS.md Use this script to compare the performance of Graphviz builds before and after changes. Ensure Graphviz is installed in separate directories for comparison. ```bash python3 tests/compare_performance.py /tmp/before/bin/dot /tmp/after/bin/dot ``` -------------------------------- ### Install Windows Dependencies Source: https://gitlab.com/graphviz/graphviz/-/blob/main/cmd/tools/CMakeLists.txt Conditionally installs runtime libraries for EXPAT and GETOPT on Windows systems when 'install_win_dependency_dlls' is enabled and the system is not MinGW. This ensures that the application can find its required DLLs at runtime. ```cmake install( FILES ${EXPAT_RUNTIME_LIBRARIES} DESTINATION ${BINARY_INSTALL_DIR} ) ``` ```cmake install( FILES ${GETOPT_RUNTIME_LIBRARIES} DESTINATION ${BINARY_INSTALL_DIR} ) ``` -------------------------------- ### Create Man Page Installation Target Source: https://gitlab.com/graphviz/graphviz/-/blob/main/lib/pack/CMakeLists.txt Defines a custom target 'man-pack' that depends on the compressed man page 'pack.3.gz'. This target ensures the man page is built and installed. ```cmake add_custom_target(man-pack ALL DEPENDS pack.3.gz COMMENT "pack man page") ``` -------------------------------- ### Install gvc++ Header Files Source: https://gitlab.com/graphviz/graphviz/-/blob/main/lib/gvc++/CMakeLists.txt Installs the public header files for the gvc++ library to the designated header directory. This allows users to include the necessary headers in their projects. ```cmake install( FILES GVContext.h GVLayout.h GVRenderData.h DESTINATION ${HEADER_INSTALL_DIR} ) ``` -------------------------------- ### Configure Version Header Source: https://gitlab.com/graphviz/graphviz/-/blob/main/CMakeLists.txt Configures the graphviz_version.h file using a template and installs it. ```cmake configure_file(graphviz_version.h.in ${CMAKE_CURRENT_BINARY_DIR}/graphviz_version.h @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/graphviz_version.h DESTINATION ${HEADER_INSTALL_DIR}) ``` -------------------------------- ### Configure 'gc' Tool Source: https://gitlab.com/graphviz/graphviz/-/blob/main/cmd/tools/CMakeLists.txt Configures the 'gc' tool, which is a more complex tool. It sets up include directories, links libraries including 'cgraph', 'gvc', and 'util', and handles installation and man page compression similar to default tool settings. ```cmake add_executable(gc_bin gc.c) set_target_properties(gc_bin PROPERTIES OUTPUT_NAME "gc") target_include_directories(gc_bin PRIVATE ../../lib ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ../../lib/cdt ../../lib/cgraph ../../lib/common ../../lib/gvc ../../lib/pack ../../lib/pathplan ) if(GETOPT_FOUND) target_include_directories(gc_bin SYSTEM PRIVATE ${GETOPT_INCLUDE_DIRS}) endif() if(NOT HAVE_GETOPT_H) target_link_libraries(gc_bin PRIVATE ${GETOPT_LINK_LIBRARIES}) endif() target_link_libraries(gc_bin PRIVATE cgraph gvc util ) install( TARGETS gc_bin RUNTIME DESTINATION ${BINARY_INSTALL_DIR} LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR} ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR} ) if(GZIP) add_custom_target(man-gc ALL DEPENDS gc.1.gz COMMENT "gc man page") add_custom_command( OUTPUT gc.1.gz COMMAND ${GZIP} -9 --no-name --to-stdout gc.1 >"${CMAKE_CURRENT_BINARY_DIR}/gc.1.gz" MAIN_DEPENDENCY gc.1 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "compress gc man page") install( FILES ${CMAKE_CURRENT_BINARY_DIR}/gc.1.gz DESTINATION ${MAN_INSTALL_DIR}/man1) else() install( FILES gc.1 DESTINATION ${MAN_INSTALL_DIR}/man1 ) endif() ``` -------------------------------- ### SWIG Go Library Configuration Source: https://gitlab.com/graphviz/graphviz/-/blob/main/tclpkg/gv/CMakeLists.txt Configures SWIG to build a Go library for Graphviz. Includes custom targets for generating Go files and runtime headers, and installation paths. ```cmake swig_add_library(gv_go LANGUAGE go SOURCES gv.cpp gv.i gv_builtins.c gv_dummy_init.c ) target_compile_definitions(gv_go PRIVATE DEMAND_LOADING=1) set_property( TARGET gv_go PROPERTY SWIG_COMPILE_OPTIONS -intgosize ${INTGOSIZE} ) if(HAVE_CXX_WUNUSED_FUNCTION) set_property( TARGET gv_go PROPERTY SWIG_GENERATED_COMPILE_OPTIONS -Wno-unused-function ) endif() target_link_libraries(gv_go PRIVATE cdt cgraph gvc) add_custom_target(gv.go COMMAND echo "package gv" >gv.go BYPRODUCTS gv.go COMMENT "generating gv.go" ) add_dependencies(gv_go gv.go) add_custom_target(runtime.h COMMAND ${SWIG_EXECUTABLE} -c++ -go -intgosize ${INTGOSIZE} -external-runtime runtime.h BYPRODUCTS runtime.h COMMENT "generating runtime.h" ) add_dependencies(gv_go runtime.h) install( TARGETS gv_go RUNTIME DESTINATION ${BINARY_INSTALL_DIR} LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}/graphviz/go ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR} ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/gv.go ${CMAKE_CURRENT_BINARY_DIR}/runtime.h DESTINATION ${LIBRARY_INSTALL_DIR}/graphviz/go ) ``` -------------------------------- ### SWIG C# Library Configuration Source: https://gitlab.com/graphviz/graphviz/-/blob/main/tclpkg/gv/CMakeLists.txt Configures SWIG to build a C# library for Graphviz. Includes target definitions and installation paths. ```cmake swig_add_library(gv_sharp LANGUAGE csharp SOURCES gv.cpp gv.i gv_builtins.c gv_dummy_init.c ) target_compile_definitions(gv_sharp PRIVATE DEMAND_LOADING=1) set_property(TARGET gv_sharp PROPERTY SWIG_COMPILE_OPTIONS -namespace) target_link_libraries(gv_sharp PRIVATE cdt cgraph gvc) get_property(gv_sharp_support TARGET gv_sharp PROPERTY SWIG_SUPPORT_FILES_DIRECTORY ) install( TARGETS gv_sharp RUNTIME DESTINATION ${BINARY_INSTALL_DIR} LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}/graphviz/sharp ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR} ) install( DIRECTORY ${gv_sharp_support}/ DESTINATION ${LIBRARY_INSTALL_DIR}/graphviz/sharp ) ``` -------------------------------- ### Configure gxl2gv Executable Source: https://gitlab.com/graphviz/graphviz/-/blob/main/cmd/tools/CMakeLists.txt Configures the gxl2gv executable, including its source files, include directories, and linked libraries. It also handles conditional setup for EXPAT and GETOPT, and creates aliases with symlinks or copies for different platforms. ```cmake if(EXPAT_FOUND) add_executable(gxl2gv # Source files cvtgxl.c gv2gxl.c gxl2gv.c ) target_include_directories(gxl2gv PRIVATE ../../lib ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ../../lib/cdt ../../lib/cgraph ../../lib/common ../../lib/gvc ../../lib/pack ../../lib/pathplan ) target_include_directories(gxl2gv SYSTEM PRIVATE ${EXPAT_INCLUDE_DIRS} ) if(GETOPT_FOUND) target_include_directories(gxl2gv SYSTEM PRIVATE ${GETOPT_INCLUDE_DIRS} ) endif() target_link_libraries(gxl2gv PRIVATE cgraph util ${EXPAT_LIBRARIES} ) tool_defaults(gxl2gv) 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 $ ${GXL2GV_COPY} COMMENT "Copying gxl2gv to ${GXL2GV_COPY}" ) install( PROGRAMS ${GXL2GV_COPY} DESTINATION ${BINARY_INSTALL_DIR} ) if(GZIP) add_custom_target(man-${cmd_alias} ALL DEPENDS ${cmd_alias}.1.gz COMMENT "${cmd_alias} man page" ) add_custom_command( OUTPUT ${cmd_alias}.1.gz COMMAND ${CMAKE_COMMAND} -E copy gxl2gv.1.gz ${cmd_alias}.1.gz MAIN_DEPENDENCY gxl2gv.1.gz COMMENT "Copying gxl2gv.1.gz to ${cmd_alias}.1.gz" ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${cmd_alias}.1.gz DESTINATION ${MAN_INSTALL_DIR}/man1 ) else() install( FILES gxl2gv.1 DESTINATION ${MAN_INSTALL_DIR}/man1 RENAME ${cmd_alias}.1 ) endif() else() add_custom_command( TARGET gxl2gv POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $ ${cmd_alias} COMMENT "Linking gxl2gv as ${cmd_alias}") install( FILES ${GXL2GV_COPY} DESTINATION ${BINARY_INSTALL_DIR} ) if(GZIP) add_custom_target(man-${cmd_alias} ALL DEPENDS ${cmd_alias}.1.gz COMMENT "${cmd_alias} man page" ) add_custom_command( OUTPUT ${cmd_alias}.1.gz COMMAND ${CMAKE_COMMAND} -E create_symlink gxl2gv.1.gz ${cmd_alias}.1.gz COMMENT "Linking gxl2gv.1.gz as ${cmd_alias}.1.gz" ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${cmd_alias}.1.gz DESTINATION ${MAN_INSTALL_DIR}/man1 ) else() add_custom_target(man-${cmd_alias} ALL DEPENDS ${cmd_alias}.1 COMMENT "${cmd_alias} man page" ) add_custom_command( OUTPUT ${cmd_alias}.1 COMMAND ${CMAKE_COMMAND} -E create_symlink gxl2gv.1 ${cmd_alias}.1 COMMENT "Linking gxl2gv.1 as ${cmd_alias}.1" ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${cmd_alias}.1 DESTINATION ${MAN_INSTALL_DIR}/man1 ) endif() endif() endforeach() endif() ``` -------------------------------- ### Adjust CMAKE_INSTALL_RPATH for Libraries Source: https://gitlab.com/graphviz/graphviz/-/blob/main/plugin/CMakeLists.txt Configures the installation runtime path for libraries. Use '@executable_path/..' on Apple systems and '$ORIGIN/..' on others to ensure plugins can find Graphviz libraries. ```cmake if(APPLE) list(APPEND CMAKE_INSTALL_RPATH "@executable_path/..") else() list(APPEND CMAKE_INSTALL_RPATH "$ORIGIN/..") endif() ``` -------------------------------- ### SWIG Guile Library Configuration Source: https://gitlab.com/graphviz/graphviz/-/blob/main/tclpkg/gv/CMakeLists.txt Configures SWIG to build a Guile library for Graphviz. Includes target definitions, include directories, and installation paths. ```cmake swig_add_library(gv_guile LANGUAGE guile SOURCES gv.cpp gv.i gv_builtins.c gv_dummy_init.c ) target_compile_definitions(gv_guile PRIVATE DEMAND_LOADING=1) set_property( TARGET gv_guile PROPERTY SWIG_GENERATED_INCLUDE_DIRECTORIES ${GUILE_INCLUDE_DIRS} ) if(HAVE_CXX_WUNUSED_PARAMETER) set_property( TARGET gv_guile PROPERTY SWIG_GENERATED_COMPILE_OPTIONS -Wno-unused-parameter ) endif() target_link_libraries( gv_guile PRIVATE cdt cgraph gvc ${GUILE_LINK_LIBRARIES} ) install( TARGETS gv_guile RUNTIME DESTINATION ${BINARY_INSTALL_DIR} LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}/graphviz/guile ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR} ) ``` -------------------------------- ### SWIG D Library Configuration Source: https://gitlab.com/graphviz/graphviz/-/blob/main/tclpkg/gv/CMakeLists.txt Configures SWIG to build a D library for Graphviz. Includes target definitions and installation paths. ```cmake swig_add_library(gv_d LANGUAGE d SOURCES gv.cpp gv.i gv_builtins.c gv_dummy_init.c ) target_compile_definitions(gv_d PRIVATE DEMAND_LOADING=1) target_link_libraries(gv_d PRIVATE cdt cgraph gvc) install( TARGETS gv_d RUNTIME DESTINATION ${BINARY_INSTALL_DIR} LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}/graphviz/d ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR} ) ``` -------------------------------- ### Generate and Install Compressed Man Page Source: https://gitlab.com/graphviz/graphviz/-/blob/main/cmd/edgepaint/CMakeLists.txt Conditionally creates a custom target for the compressed man page (edgepaint.1.gz) if GZIP is enabled. It uses a custom command to compress the man page. ```cmake add_custom_target(man-edgepaint ALL DEPENDS edgepaint.1.gz COMMENT "edgepaint man page") ``` ```cmake add_custom_command( OUTPUT edgepaint.1.gz COMMAND ${GZIP} -9 --no-name --to-stdout edgepaint.1 >"${CMAKE_CURRENT_BINARY_DIR}/edgepaint.1.gz" MAIN_DEPENDENCY edgepaint.1 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "compress edgepaint man page") ``` ```cmake install( FILES ${CMAKE_CURRENT_BINARY_DIR}/edgepaint.1.gz DESTINATION ${MAN_INSTALL_DIR}/man1) ``` -------------------------------- ### Using tailpsfrag and headpsfrag for Edge Ends Source: https://gitlab.com/graphviz/graphviz/-/blob/main/doc/latex_suggestions.txt Similar to `psfrag`, `tailpsfrag` and `headpsfrag` attributes can be used to apply LaTeX formatting to the start and end of edge labels, respectively. This requires the same setup as the `psfrag` attribute. -------------------------------- ### Configure Ruby Language Binding Source: https://gitlab.com/graphviz/graphviz/-/blob/main/tclpkg/gv/CMakeLists.txt Configures the Ruby language binding for Graphviz. This includes SWIG setup, conditional compilation flags for unused parameters and shadow warnings, linking to core libraries, and defining installation paths. ```cmake if(ENABLE_RUBY) swig_add_library(gv_ruby LANGUAGE ruby SOURCES gv.cpp gv.i gv_builtins.c gv_dummy_init.c ) target_compile_definitions(gv_ruby PRIVATE DEMAND_LOADING=1) set_property( TARGET gv_ruby PROPERTY SWIG_GENERATED_INCLUDE_DIRECTORIES ${Ruby_INCLUDE_DIRS} ) set(RUBY_FLAGS "") if(HAVE_CXX_WUNUSED_PARAMETER) list(APPEND RUBY_FLAGS -Wno-unused-parameter) endif() if(HAVE_CXX_WSHADOW) list(APPEND RUBY_FLAGS -Wno-shadow) endif() set_property( TARGET gv_ruby PROPERTY SWIG_GENERATED_COMPILE_OPTIONS "${RUBY_FLAGS}" ) target_link_libraries(gv_ruby PRIVATE cdt cgraph gvc ${Ruby_LIBRARIES}) install( TARGETS gv_ruby RUNTIME DESTINATION ${BINARY_INSTALL_DIR} LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}/graphviz/ruby ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR} ) endif() ``` -------------------------------- ### Configure mm2gv Executable Source: https://gitlab.com/graphviz/graphviz/-/blob/main/cmd/tools/CMakeLists.txt Sets up the mm2gv executable, specifying its source files, include directories, and linked libraries. It also includes conditional include directories if GETOPT is found. ```cmake add_executable(mm2gv # Source files matrix_market.c mm2gv.c mmio.c ) target_include_directories(mm2gv PRIVATE ../../lib ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ../../lib/cdt ../../lib/cgraph ../../lib/common ../../lib/gvc ../../lib/pack ../../lib/pathplan ) if(GETOPT_FOUND) target_include_directories(mm2gv SYSTEM PRIVATE ${GETOPT_INCLUDE_DIRS} ) endif() target_link_libraries(mm2gv PRIVATE sparse cgraph gvc ) tool_defaults(mm2gv) ``` -------------------------------- ### Create Static Library Source: https://gitlab.com/graphviz/graphviz/-/blob/main/lib/circogen/CMakeLists.txt Defines a static library named 'circogen' and lists its source files. Ensure all listed C files are present in the directory. ```cmake add_library(circogen STATIC block.c blockpath.c blocktree.c circpos.c circular.c circularinit.c edgelist.c nodelist.c ) ``` -------------------------------- ### Install vimdot script Source: https://gitlab.com/graphviz/graphviz/-/blob/main/plugin/xlib/CMakeLists.txt Installs the vimdot.sh script, renaming it to vimdot and setting appropriate file permissions. This is part of the Graphviz build process. ```cmake install( FILES vimdot.sh DESTINATION ${BINARY_INSTALL_DIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE RENAME vimdot ) ``` -------------------------------- ### Add Simple Tool Configuration Source: https://gitlab.com/graphviz/graphviz/-/blob/main/cmd/tools/CMakeLists.txt Adds a simple tool executable from a single C source file. It sets up include directories, links necessary libraries, and applies default tool properties. This is suitable for tools with straightforward dependencies. ```cmake function(add_simple_tool name) add_executable(${name} ${name}.c) target_include_directories(${name} PRIVATE ../../lib ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ../../lib/cdt ../../lib/cgraph ../../lib/common ../../lib/gvc ../../lib/pack ../../lib/pathplan ) if(GETOPT_FOUND) target_include_directories(${name} SYSTEM PRIVATE ${GETOPT_INCLUDE_DIRS} ) endif() target_link_libraries(${name} PRIVATE cgraph ) tool_defaults(${name}) endfunction(add_simple_tool) ``` -------------------------------- ### Install Graphviz CMake Export Files Source: https://gitlab.com/graphviz/graphviz/-/blob/main/lib/CMakeLists.txt Installs CMake export files for Graphviz targets if 'BUILD_SHARED_LIBS' is enabled. This allows other CMake projects to find and use Graphviz libraries. ```cmake install( EXPORT graphvizTargets FILE graphvizTargets.cmake NAMESPACE graphviz:: DESTINATION ${LIBRARY_INSTALL_DIR}/cmake/graphviz ) install( FILES graphvizConfig.cmake DESTINATION ${LIBRARY_INSTALL_DIR}/cmake/graphviz ) ``` -------------------------------- ### Set Install RPATH for Libraries Source: https://gitlab.com/graphviz/graphviz/-/blob/main/lib/CMakeLists.txt Configures the RPATH for library installation, adjusting for Apple systems to use '@executable_path' and other systems to use '$ORIGIN'. This ensures libraries can find each other at runtime. ```cmake if(APPLE) list(APPEND CMAKE_INSTALL_RPATH "@executable_path") else() list(APPEND CMAKE_INSTALL_RPATH "$ORIGIN") endif() ``` -------------------------------- ### Define Default Tool Properties Source: https://gitlab.com/graphviz/graphviz/-/blob/main/cmd/tools/CMakeLists.txt Sets default values for tools, including linking to getopt if required, installing executables, and installing man pages. This function is intended to be called by other tool-specific functions. ```cmake function(tool_defaults name) if(NOT HAVE_GETOPT_H) target_link_libraries(${name} PRIVATE ${GETOPT_LINK_LIBRARIES}) endif() install( TARGETS ${name} RUNTIME DESTINATION ${BINARY_INSTALL_DIR} LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR} ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR} ) if(GZIP) add_custom_target(man-${name} ALL DEPENDS ${name}.1.gz COMMENT "${name} man page") add_custom_command( OUTPUT ${name}.1.gz COMMAND ${GZIP} -9 --no-name --to-stdout ${name}.1 >"${CMAKE_CURRENT_BINARY_DIR}/${name}.1.gz" MAIN_DEPENDENCY ${name}.1 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "compress ${name} man page") install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}.1.gz DESTINATION ${MAN_INSTALL_DIR}/man1) else() install( FILES ${name}.1 DESTINATION ${MAN_INSTALL_DIR}/man1 ) endif() endfunction(tool_defaults) ``` -------------------------------- ### Define Graphviz Neato Layout Library Source: https://gitlab.com/graphviz/graphviz/-/blob/main/plugin/neato_layout/CMakeLists.txt Defines the `gvplugin_neato_layout` library and lists its source files. This is a foundational step for building the plugin. ```cmake add_library(gvplugin_neato_layout # Source files gvplugin_neato_layout.c gvlayout_neato_layout.c ) ``` -------------------------------- ### Add Library and Link Dependencies Source: https://gitlab.com/graphviz/graphviz/-/blob/main/lib/topfish/CMakeLists.txt Defines a static library 'topfish' with its source files and links it with 'gvc' and 'neatogen' libraries. This snippet is conditional on the WITH_SMYRNA flag. ```cmake if(WITH_SMYRNA) add_library(topfish STATIC hierarchy.c rescale_layout.c ) target_include_directories(topfish PRIVATE .. ../common ) target_link_libraries(topfish PRIVATE gvc neatogen ) endif() ``` -------------------------------- ### System Include Directories and Libraries Source: https://gitlab.com/graphviz/graphviz/-/blob/main/tclpkg/tclpathplan/CMakeLists.txt Configures system-wide include directories and links the TCL library to the 'tclplan' target. 'SYSTEM' keyword is used for include directories to suppress warnings. ```cmake target_include_directories(tclplan SYSTEM PRIVATE ${TCL_INCLUDE_PATH}) target_link_libraries(tclplan PRIVATE ${TCL_LIBRARY}) ```