From eada60699210891466ce90207fb8c4441b8fc22c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Komar=C4=8Devi=C4=87?= Date: Fri, 21 Oct 2022 13:43:45 +0200 Subject: [PATCH] Match Conan's cmake find module case for Brotli --- README.md | 2 +- ci/install_dependencies.sh | 4 ++-- cmake/{FindBROTLI.cmake => FindBrotli.cmake} | 12 ++++++++---- cmake/findDependencies.cmake | 2 +- src/CMakeLists.txt | 4 ++-- 5 files changed, 14 insertions(+), 10 deletions(-) rename cmake/{FindBROTLI.cmake => FindBrotli.cmake} (81%) diff --git a/README.md b/README.md index a9e76838..6d256e73 100644 --- a/README.md +++ b/README.md @@ -1260,7 +1260,7 @@ The CI workflow file `.github/workflows/on_PR_windows_matrix.yml` has a build jo Please note that you will need to install the `ucrt-x86_64` package version of the exiv2 dependencies: ```bash -pacman -S mingw-w64-ucrt-x86_64-{brotli,cc,cmake,curl,expat,gettext,gtest,libiconv,libwinpthread,ninja,zlib} +pacman -S --needed mingw-w64-ucrt-x86_64-{brotli,cc,cmake,curl,expat,gettext,gtest,libiconv,libwinpthread,ninja,zlib} ``` ### Download exiv2 from github and build diff --git a/ci/install_dependencies.sh b/ci/install_dependencies.sh index acef7180..63885dba 100755 --- a/ci/install_dependencies.sh +++ b/ci/install_dependencies.sh @@ -23,7 +23,7 @@ debian_build_gtest() { # workaround for really bare-bones Archlinux containers: if [ -x "$(command -v pacman)" ]; then pacman --noconfirm -Sy - pacman --noconfirm -S grep gawk sed + pacman --noconfirm --needed -S grep gawk sed fi distro_id=$(grep '^ID=' /etc/os-release|awk -F = '{print $2}'|sed 's/\"//g') @@ -41,7 +41,7 @@ case "$distro_id" in 'arch') pacman --noconfirm -Syu - pacman --noconfirm -S gcc clang cmake make expat zlib brotli libssh curl gtest dos2unix which diffutils + pacman --noconfirm --needed -S gcc clang cmake make expat zlib brotli libssh curl gtest dos2unix which diffutils ;; 'ubuntu') diff --git a/cmake/FindBROTLI.cmake b/cmake/FindBrotli.cmake similarity index 81% rename from cmake/FindBROTLI.cmake rename to cmake/FindBrotli.cmake index 0ed08550..ea86ed79 100644 --- a/cmake/FindBROTLI.cmake +++ b/cmake/FindBrotli.cmake @@ -26,7 +26,7 @@ find_path(BROTLI_INCLUDE_DIR "brotli/decode.h") find_library(BROTLICOMMON_LIBRARY NAMES brotlicommon) find_library(BROTLIDEC_LIBRARY NAMES brotlidec) -find_package_handle_standard_args(BROTLI +find_package_handle_standard_args(Brotli FOUND_VAR BROTLI_FOUND REQUIRED_VARS @@ -34,8 +34,12 @@ find_package_handle_standard_args(BROTLI BROTLICOMMON_LIBRARY BROTLI_INCLUDE_DIR FAIL_MESSAGE - "Could NOT find BROTLI" + "Could NOT find Brotli" ) -set(BROTLI_INCLUDE_DIRS ${BROTLI_INCLUDE_DIR}) -set(BROTLI_LIBRARIES ${BROTLICOMMON_LIBRARY} ${BROTLIDEC_LIBRARY}) +set(Brotli_INCLUDE_DIRS ${BROTLI_INCLUDE_DIR}) +set(Brotli_LIBRARIES ${BROTLICOMMON_LIBRARY} ${BROTLIDEC_LIBRARY}) + +mark_as_advanced(BROTLI_INCLUDE_DIR) +mark_as_advanced(BROTLICOMMON_LIBRARY) +mark_as_advanced(BROTLIDEC_LIBRARY) diff --git a/cmake/findDependencies.cmake b/cmake/findDependencies.cmake index fb10ccc0..749306f4 100644 --- a/cmake/findDependencies.cmake +++ b/cmake/findDependencies.cmake @@ -47,7 +47,7 @@ if( EXIV2_ENABLE_PNG ) endif( ) if( EXIV2_ENABLE_BMFF ) - find_package( BROTLI ) + find_package( Brotli ) endif( ) if( EXIV2_ENABLE_WEBREADY ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index de7ccc28..108f6560 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -233,8 +233,8 @@ if( EXIV2_ENABLE_PNG ) endif() if( EXIV2_ENABLE_BMFF AND BROTLI_FOUND ) - target_link_libraries( exiv2lib PRIVATE ${BROTLI_LIBRARIES}) - target_include_directories(exiv2lib PRIVATE ${BROTLI_INCLUDE_DIRS}) + target_link_libraries( exiv2lib PRIVATE ${Brotli_LIBRARIES}) + target_include_directories(exiv2lib PRIVATE ${Brotli_INCLUDE_DIRS}) endif() if( EXIV2_ENABLE_NLS )