CMake: always define BROTLI_LIBRARIES

Previously FREETYPE_LIBRARIES would sometimes contain
BROTLI libraries, since some configurations set them separately,
declare them separately under all configurations to avoid
changes to one platform breaking others.

Also quiets uninitialized variable warning.
This commit is contained in:
Campbell Barton
2023-08-17 11:53:58 +10:00
parent c713c70781
commit cfc9473c3f
3 changed files with 11 additions and 2 deletions

View File

@@ -145,9 +145,10 @@ endif()
# FreeType compiled with Brotli compression for woff2.
find_package(Freetype REQUIRED)
list(APPEND FREETYPE_LIBRARIES
set(BROTLI_LIBRARIES
${LIBDIR}/brotli/lib/libbrotlicommon-static.a
${LIBDIR}/brotli/lib/libbrotlidec-static.a)
${LIBDIR}/brotli/lib/libbrotlidec-static.a
)
if(WITH_IMAGE_OPENEXR)
find_package(OpenEXR)

View File

@@ -144,6 +144,9 @@ if(NOT WITH_SYSTEM_FREETYPE)
# list(APPEND FREETYPE_LIBRARIES
# ${BROTLI_LIBRARIES}
# )
else()
# Quiet warning as this variable will be used after `FREETYPE_LIBRARIES`.
set(BROTLI_LIBRARIES "")
endif()
check_freetype_for_brotli()
endif()
@@ -604,6 +607,8 @@ if(WITH_SYSTEM_FREETYPE)
message(FATAL_ERROR "Failed finding system FreeType version!")
endif()
check_freetype_for_brotli()
# Quiet warning as this variable will be used after `FREETYPE_LIBRARIES`.
set(BROTLI_LIBRARIES "")
endif()
if(WITH_LZO AND WITH_SYSTEM_LZO)

View File

@@ -364,9 +364,12 @@ set(FREETYPE_INCLUDE_DIRS
)
set(FREETYPE_LIBRARIES
${LIBDIR}/freetype/lib/freetype2ST.lib
)
set(BROTLI_LIBRARIES
${LIBDIR}/brotli/lib/brotlidec-static.lib
${LIBDIR}/brotli/lib/brotlicommon-static.lib
)
windows_find_package(Freetype REQUIRED)
if(WITH_FFTW3)