From 4189a82e483e27149f510b109e4c63ce53588dac Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 5 Nov 2022 09:24:57 -0700 Subject: [PATCH] add prune to the CMake build system Gitlab: #1836 --- CHANGELOG.md | 4 ++++ CMakeLists.txt | 1 + ci/tests.py | 1 - contrib/prune/CMakeLists.txt | 42 ++++++++++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 contrib/prune/CMakeLists.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index c185ed210..b2586f1f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased (7.0.2)] +### Added + +- The `prune` utility is now included in the CMake build system. #1836 + ## [7.0.1] – 2022-11-09 ### Added diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d708e288..482a8c44c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -247,6 +247,7 @@ include(CTest) # ======================= Specify subdirectories to build ====================== add_subdirectory(contrib/diffimg) +add_subdirectory(contrib/prune) add_subdirectory(graphs) add_subdirectory(lib) add_subdirectory(plugin) diff --git a/ci/tests.py b/ci/tests.py index e98a67205..4cede5687 100644 --- a/ci/tests.py +++ b/ci/tests.py @@ -103,7 +103,6 @@ def test_existence(binary: str): "gv2gxl", "gvedit", "gxl2dot", - "prune", ] tools_not_built_with_msbuild = [ diff --git a/contrib/prune/CMakeLists.txt b/contrib/prune/CMakeLists.txt new file mode 100644 index 000000000..c5b183f00 --- /dev/null +++ b/contrib/prune/CMakeLists.txt @@ -0,0 +1,42 @@ +add_executable(prune generic_list.c prune.c) +target_include_directories(prune PRIVATE + ../../lib + ../../lib/cdt) +target_link_libraries(prune PRIVATE cdt cgraph ingraphs) + +if(GETOPT_FOUND) + target_include_directories(prune SYSTEM PRIVATE + ${GETOPT_INCLUDE_DIRS} + ) +endif() + +if(NOT HAVE_GETOPT_H) + target_link_libraries(prune PRIVATE ${GETOPT_LINK_LIBRARIES}) +endif() + +install( + TARGETS prune + RUNTIME DESTINATION ${BINARY_INSTALL_DIR} + LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR} +) + +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() -- 2.40.0