From e962645adb5e549553f99e345a85775d3ac92cd4 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Mon, 31 Jan 2022 22:15:38 +1100 Subject: [PATCH] CMake: [nfc] uppercase 'Getopt_*' variables Upcoming changes that introduce `cmake-format` checks complain that these identifiers do not comply with `[A-Z][0-9A-Z_]+|_[0-9a-z_]+`. --- CMakeLists.txt | 2 +- cmake/FindGETOPT.cmake | 23 +++++++++++++++++++++++ cmake/FindGetopt.cmake | 23 ----------------------- cmd/tools/CMakeLists.txt | 28 ++++++++++++++-------------- lib/gvpr/CMakeLists.txt | 4 ++-- 5 files changed, 40 insertions(+), 40 deletions(-) create mode 100644 cmake/FindGETOPT.cmake delete mode 100644 cmake/FindGetopt.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 74d35cc6f..684747250 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -200,7 +200,7 @@ message(STATUS "Graphviz version: ${GRAPHVIZ_VERSION_FULL}") include(config_checks) if(NOT HAVE_GETOPT_H) - find_package(Getopt REQUIRED) + find_package(GETOPT REQUIRED) endif() include_directories(${CMAKE_CURRENT_BINARY_DIR}) diff --git a/cmake/FindGETOPT.cmake b/cmake/FindGETOPT.cmake new file mode 100644 index 000000000..3a9adb99b --- /dev/null +++ b/cmake/FindGETOPT.cmake @@ -0,0 +1,23 @@ +include(FindPackageHandleStandardArgs) + +find_path(GETOPT_INCLUDE_DIR getopt.h) +find_library(GETOPT_LIBRARY NAMES getopt) +find_program(GETOPT_RUNTIME_LIBRARY NAMES getopt.dll) + +if(WIN32) + find_package_handle_standard_args(GETOPT DEFAULT_MSG + GETOPT_INCLUDE_DIR + GETOPT_LIBRARY + GETOPT_RUNTIME_LIBRARY + ) +else() + find_package_handle_standard_args(GETOPT DEFAULT_MSG + GETOPT_INCLUDE_DIR + GETOPT_LIBRARY + ) +endif() + +set(GETOPT_INCLUDE_DIRS ${GETOPT_INCLUDE_DIR}) +set(GETOPT_LIBRARIES ${GETOPT_LIBRARY}) +set(GETOPT_LINK_LIBRARIES ${GETOPT_LIBRARY}) +set(GETOPT_RUNTIME_LIBRARIES ${GETOPT_RUNTIME_LIBRARY}) diff --git a/cmake/FindGetopt.cmake b/cmake/FindGetopt.cmake deleted file mode 100644 index 6e5b80dd6..000000000 --- a/cmake/FindGetopt.cmake +++ /dev/null @@ -1,23 +0,0 @@ -include(FindPackageHandleStandardArgs) - -find_path(Getopt_INCLUDE_DIR getopt.h) -find_library(Getopt_LIBRARY NAMES getopt) -find_program(Getopt_RUNTIME_LIBRARY NAMES getopt.dll) - -if(WIN32) - find_package_handle_standard_args(Getopt DEFAULT_MSG - Getopt_INCLUDE_DIR - Getopt_LIBRARY - Getopt_RUNTIME_LIBRARY - ) -else() - find_package_handle_standard_args(Getopt DEFAULT_MSG - Getopt_INCLUDE_DIR - Getopt_LIBRARY - ) -endif() - -set(Getopt_INCLUDE_DIRS ${Getopt_INCLUDE_DIR}) -set(Getopt_LIBRARIES ${Getopt_LIBRARY}) -set(Getopt_LINK_LIBRARIES ${Getopt_LIBRARY}) -set(Getopt_RUNTIME_LIBRARIES ${Getopt_RUNTIME_LIBRARY}) diff --git a/cmd/tools/CMakeLists.txt b/cmd/tools/CMakeLists.txt index 3be27f275..88b3f1da5 100644 --- a/cmd/tools/CMakeLists.txt +++ b/cmd/tools/CMakeLists.txt @@ -4,7 +4,7 @@ # - installation of manpage function(tool_defaults name) if(NOT HAVE_GETOPT_H) - target_link_libraries(${name} ${Getopt_LINK_LIBRARIES}) + target_link_libraries(${name} ${GETOPT_LINK_LIBRARIES}) endif() install( @@ -48,7 +48,7 @@ function(add_simple_tool name) ${GRAPHVIZ_LIB_DIR}/gvc ${GRAPHVIZ_LIB_DIR}/pack ${GRAPHVIZ_LIB_DIR}/pathplan - ${Getopt_INCLUDE_DIRS} + ${GETOPT_INCLUDE_DIRS} ) target_link_libraries(${name} @@ -88,7 +88,7 @@ target_include_directories(dijkstra PRIVATE ${GRAPHVIZ_LIB_DIR}/gvc ${GRAPHVIZ_LIB_DIR}/pack ${GRAPHVIZ_LIB_DIR}/pathplan - ${Getopt_INCLUDE_DIRS} + ${GETOPT_INCLUDE_DIRS} ) target_link_libraries(dijkstra @@ -122,7 +122,7 @@ target_include_directories(gml2gv PRIVATE ${GRAPHVIZ_LIB_DIR}/gvc ${GRAPHVIZ_LIB_DIR}/pack ${GRAPHVIZ_LIB_DIR}/pathplan - ${Getopt_INCLUDE_DIRS} + ${GETOPT_INCLUDE_DIRS} ) target_link_libraries(gml2gv @@ -139,10 +139,10 @@ target_include_directories(gv2gml PRIVATE ${GRAPHVIZ_LIB_DIR}/common ${GRAPHVIZ_LIB_DIR}/gvc ${GRAPHVIZ_LIB_DIR}/pathplan - ${Getopt_INCLUDE_DIRS}) + ${GETOPT_INCLUDE_DIRS}) target_link_libraries(gv2gml cgraph gvc ingraphs) if(NOT HAVE_GETOPT_H) - target_link_libraries(gv2gml ${Getopt_LINK_LIBRARIES}) + target_link_libraries(gv2gml ${GETOPT_LINK_LIBRARIES}) endif() install(TARGETS gv2gml RUNTIME DESTINATION ${BINARY_INSTALL_DIR}) @@ -165,7 +165,7 @@ target_include_directories(graphml2gv PRIVATE ${GRAPHVIZ_LIB_DIR}/pack ${GRAPHVIZ_LIB_DIR}/pathplan ${EXPAT_INCLUDE_DIRS} - ${Getopt_INCLUDE_DIRS} + ${GETOPT_INCLUDE_DIRS} ) target_link_libraries(graphml2gv @@ -197,7 +197,7 @@ target_include_directories(gvcolor PRIVATE ${GRAPHVIZ_LIB_DIR}/gvc ${GRAPHVIZ_LIB_DIR}/pack ${GRAPHVIZ_LIB_DIR}/pathplan - ${Getopt_INCLUDE_DIRS} + ${GETOPT_INCLUDE_DIRS} ) target_link_libraries(gvcolor @@ -224,7 +224,7 @@ target_include_directories(gvgen PRIVATE ${GRAPHVIZ_LIB_DIR}/gvc ${GRAPHVIZ_LIB_DIR}/pack ${GRAPHVIZ_LIB_DIR}/pathplan - ${Getopt_INCLUDE_DIRS} + ${GETOPT_INCLUDE_DIRS} ) target_link_libraries(gvgen cgraph) @@ -256,7 +256,7 @@ target_include_directories(gvpack PRIVATE ${GRAPHVIZ_LIB_DIR}/gvc ${GRAPHVIZ_LIB_DIR}/pack ${GRAPHVIZ_LIB_DIR}/pathplan - ${Getopt_INCLUDE_DIRS} + ${GETOPT_INCLUDE_DIRS} ) target_link_libraries(gvpack @@ -289,7 +289,7 @@ target_include_directories(gxl2gv PRIVATE ${GRAPHVIZ_LIB_DIR}/pack ${GRAPHVIZ_LIB_DIR}/pathplan ${EXPAT_INCLUDE_DIRS} - ${Getopt_INCLUDE_DIRS} + ${GETOPT_INCLUDE_DIRS} ) target_link_libraries(gxl2gv @@ -321,7 +321,7 @@ target_include_directories(mm2gv PRIVATE ${GRAPHVIZ_LIB_DIR}/gvc ${GRAPHVIZ_LIB_DIR}/pack ${GRAPHVIZ_LIB_DIR}/pathplan - ${Getopt_INCLUDE_DIRS} + ${GETOPT_INCLUDE_DIRS} ) target_link_libraries(mm2gv @@ -348,7 +348,7 @@ target_include_directories(sccmap PRIVATE ${GRAPHVIZ_LIB_DIR}/gvc ${GRAPHVIZ_LIB_DIR}/pack ${GRAPHVIZ_LIB_DIR}/pathplan - ${Getopt_INCLUDE_DIRS} + ${GETOPT_INCLUDE_DIRS} ) target_link_libraries(sccmap @@ -369,7 +369,7 @@ endif() if(WIN32 AND install_win_dependency_dlls) install( - FILES ${Getopt_RUNTIME_LIBRARIES} + FILES ${GETOPT_RUNTIME_LIBRARIES} DESTINATION ${BINARY_INSTALL_DIR} ) endif() diff --git a/lib/gvpr/CMakeLists.txt b/lib/gvpr/CMakeLists.txt index 3972918e4..5fe0c835e 100644 --- a/lib/gvpr/CMakeLists.txt +++ b/lib/gvpr/CMakeLists.txt @@ -31,7 +31,7 @@ target_include_directories(gvpr PRIVATE ${GRAPHVIZ_LIB_DIR}/cgraph ${GRAPHVIZ_LIB_DIR}/common ${GRAPHVIZ_LIB_DIR}/expr - ${Getopt_INCLUDE_DIRS} + ${GETOPT_INCLUDE_DIRS} ) target_link_libraries(gvpr @@ -45,5 +45,5 @@ target_link_libraries(gvpr ) if(NOT HAVE_GETOPT_H) - target_link_libraries(gvpr ${Getopt_LINK_LIBRARIES}) + target_link_libraries(gvpr ${GETOPT_LINK_LIBRARIES}) endif() -- 2.40.0