Commit d3a9b095 authored by jan.koester's avatar jan.koester
Browse files

FindBrotli: create imported targets only once

find_package(Brotli) runs more than once per project when libhttppp is
found both directly and via find_dependency in another package's config
(fenstore -> fenrirds -> libhttppp), and the second add_library(IMPORTED)
failed with duplicate Brotli::Dec/Enc/Common/Brotli targets.

Co-Authored-By: default avatarClaude Opus 5.5 <noreply@anthropic.com>
parent daade0b4
Loading
Loading
Loading
Loading
+3 −1
Changes for cmake/FindBrotli.cmake: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -34,7 +34,9 @@ find_package_handle_standard_args(Brotli
# 3. Define Imported Shared Targets
# -----------------------------------------------------------------------------

if(BROTLI_FOUND)
# find_package(Brotli) can run more than once per project (directly and via
# find_dependency in other packages' configs): create the targets only once
if(BROTLI_FOUND AND NOT TARGET Brotli::Brotli)

    # Define a helper function to set common properties for shared targets
    function(configure_brotli_shared_target NAME LIB_VAR)