From a453bcd0dfe30c6ef8a46a57b301847f49888928 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Mon, 31 Jan 2022 17:57:50 +1100 Subject: [PATCH] CMake: [nfc] uppercase 'Cairo_*' 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/FindCAIRO.cmake | 51 +++++++++++++++++++++++++++++++++++++ cmake/FindCairo.cmake | 51 ------------------------------------- plugin/pango/CMakeLists.txt | 8 +++--- 4 files changed, 56 insertions(+), 56 deletions(-) create mode 100644 cmake/FindCAIRO.cmake delete mode 100644 cmake/FindCairo.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 52a0281aa..74d35cc6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,7 +100,7 @@ if(WIN32) endif() find_package(ANN) -find_package(Cairo) +find_package(CAIRO) if(with_expat) find_package(EXPAT) diff --git a/cmake/FindCAIRO.cmake b/cmake/FindCAIRO.cmake new file mode 100644 index 000000000..6c7ba9e99 --- /dev/null +++ b/cmake/FindCAIRO.cmake @@ -0,0 +1,51 @@ +include(FindPackageHandleStandardArgs) + +if(WIN32) + find_path(CAIRO_INCLUDE_DIR cairo/cairo.h) + + find_library(CAIRO_LIBRARY NAMES cairo) + + find_program(CAIRO_RUNTIME_LIBRARY NAMES cairo.dll libcairo-2.dll) + find_program(EXPAT_RUNTIME_LIBRARY NAMES expat.dll libexpat-1.dll) + find_program(FONTCONFIG_RUNTIME_LIBRARY NAMES fontconfig.dll libfontconfig-1.dll) + find_program(PIXMAN_RUNTIME_LIBRARY NAMES pixman-1.dll libpixman-1-0.dll) + + find_package_handle_standard_args(CAIRO DEFAULT_MSG + CAIRO_INCLUDE_DIR + + CAIRO_LIBRARY + + CAIRO_RUNTIME_LIBRARY + EXPAT_RUNTIME_LIBRARY + FONTCONFIG_RUNTIME_LIBRARY + PIXMAN_RUNTIME_LIBRARY + ) + + set(CAIRO_INCLUDE_DIRS ${CAIRO_INCLUDE_DIR}) + + set(CAIRO_LIBRARIES ${CAIRO_LIBRARY}) + + set(CAIRO_LINK_LIBRARIES ${CAIRO_LIBRARY}) + + set(CAIRO_RUNTIME_LIBRARIES + ${CAIRO_RUNTIME_LIBRARY} + ${EXPAT_RUNTIME_LIBRARY} + ${FONTCONFIG_RUNTIME_LIBRARY} + ${PIXMAN_RUNTIME_LIBRARY} + ) +else() + find_package(PkgConfig) + pkg_check_modules(CAIRO cairo) + + # prior to CMake 3.12, PkgConfig does not set *_LINK_LIBRARIES, so do it + # manually + if(${CMAKE_VERSION} VERSION_LESS 3.12) + find_library(CAIRO_LINK_LIBRARIES cairo PATHS ENV LIBRARY_PATH) + endif() + + find_package_handle_standard_args(CAIRO DEFAULT_MSG + CAIRO_INCLUDE_DIRS + CAIRO_LIBRARIES + CAIRO_LINK_LIBRARIES + ) +endif() diff --git a/cmake/FindCairo.cmake b/cmake/FindCairo.cmake deleted file mode 100644 index b4cfd1022..000000000 --- a/cmake/FindCairo.cmake +++ /dev/null @@ -1,51 +0,0 @@ -include(FindPackageHandleStandardArgs) - -if(WIN32) - find_path(Cairo_INCLUDE_DIR cairo/cairo.h) - - find_library(Cairo_LIBRARY NAMES cairo) - - find_program(Cairo_RUNTIME_LIBRARY NAMES cairo.dll libcairo-2.dll) - find_program(EXPAT_RUNTIME_LIBRARY NAMES expat.dll libexpat-1.dll) - find_program(FONTCONFIG_RUNTIME_LIBRARY NAMES fontconfig.dll libfontconfig-1.dll) - find_program(PIXMAN_RUNTIME_LIBRARY NAMES pixman-1.dll libpixman-1-0.dll) - - find_package_handle_standard_args(Cairo DEFAULT_MSG - Cairo_INCLUDE_DIR - - Cairo_LIBRARY - - Cairo_RUNTIME_LIBRARY - EXPAT_RUNTIME_LIBRARY - FONTCONFIG_RUNTIME_LIBRARY - PIXMAN_RUNTIME_LIBRARY - ) - - set(Cairo_INCLUDE_DIRS ${Cairo_INCLUDE_DIR}) - - set(Cairo_LIBRARIES ${Cairo_LIBRARY}) - - set(Cairo_LINK_LIBRARIES ${Cairo_LIBRARY}) - - set(Cairo_RUNTIME_LIBRARIES - ${Cairo_RUNTIME_LIBRARY} - ${EXPAT_RUNTIME_LIBRARY} - ${FONTCONFIG_RUNTIME_LIBRARY} - ${PIXMAN_RUNTIME_LIBRARY} - ) -else() - find_package(PkgConfig) - pkg_check_modules(Cairo cairo) - - # prior to CMake 3.12, PkgConfig does not set *_LINK_LIBRARIES, so do it - # manually - if(${CMAKE_VERSION} VERSION_LESS 3.12) - find_library(Cairo_LINK_LIBRARIES cairo PATHS ENV LIBRARY_PATH) - endif() - - find_package_handle_standard_args(Cairo DEFAULT_MSG - Cairo_INCLUDE_DIRS - Cairo_LIBRARIES - Cairo_LINK_LIBRARIES - ) -endif() diff --git a/plugin/pango/CMakeLists.txt b/plugin/pango/CMakeLists.txt index 59cc5c10a..82012809e 100644 --- a/plugin/pango/CMakeLists.txt +++ b/plugin/pango/CMakeLists.txt @@ -1,4 +1,4 @@ -if(Cairo_FOUND AND PangoCairo_FOUND) +if(CAIRO_FOUND AND PangoCairo_FOUND) add_library(gvplugin_pango SHARED # Header files @@ -22,14 +22,14 @@ target_include_directories(gvplugin_pango PRIVATE ${GRAPHVIZ_LIB_DIR}/common ${GRAPHVIZ_LIB_DIR}/gvc ${GRAPHVIZ_LIB_DIR}/pathplan - ${Cairo_INCLUDE_DIRS}/cairo + ${CAIRO_INCLUDE_DIRS}/cairo ${PangoCairo_INCLUDE_DIRS} ) target_link_libraries(gvplugin_pango cgraph gvc - ${Cairo_LINK_LIBRARIES} + ${CAIRO_LINK_LIBRARIES} ${PangoCairo_LINK_LIBRARIES} ) @@ -45,7 +45,7 @@ install( if(WIN32 AND install_win_dependency_dlls) install( FILES - ${Cairo_RUNTIME_LIBRARIES} + ${CAIRO_RUNTIME_LIBRARIES} ${PangoCairo_RUNTIME_LIBRARIES} DESTINATION ${BINARY_INSTALL_DIR} ) -- 2.40.0