CMake: cache the HAVE_BROTLI result
Avoid detecting HAVE_BROTLI every time CMake runs, only re-detect if the freetype includes change.
This commit is contained in:
@@ -120,15 +120,21 @@ if(WITH_VULKAN_BACKEND)
|
||||
endif()
|
||||
|
||||
function(check_freetype_for_brotli)
|
||||
include(CheckSymbolExists)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${FREETYPE_INCLUDE_DIRS})
|
||||
check_symbol_exists(FT_CONFIG_OPTION_USE_BROTLI "freetype/config/ftconfig.h" HAVE_BROTLI)
|
||||
unset(CMAKE_REQUIRED_INCLUDES)
|
||||
if(NOT HAVE_BROTLI)
|
||||
if((DEFINED HAVE_BROTLI AND HAVE_BROTLI) AND
|
||||
(DEFINED HAVE_BROTLI_INC AND ("${HAVE_BROTLI_INC}" STREQUAL "${FREETYPE_INCLUDE_DIRS}")))
|
||||
# Pass, the includes didn't change, use the cached value.
|
||||
else()
|
||||
unset(HAVE_BROTLI CACHE)
|
||||
message(FATAL_ERROR "Freetype needs to be compiled with brotli support!")
|
||||
include(CheckSymbolExists)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${FREETYPE_INCLUDE_DIRS})
|
||||
check_symbol_exists(FT_CONFIG_OPTION_USE_BROTLI "freetype/config/ftconfig.h" HAVE_BROTLI)
|
||||
unset(CMAKE_REQUIRED_INCLUDES)
|
||||
if(NOT HAVE_BROTLI)
|
||||
unset(HAVE_BROTLI CACHE)
|
||||
message(FATAL_ERROR "Freetype needs to be compiled with brotli support!")
|
||||
endif()
|
||||
set(HAVE_BROTLI_INC "${FREETYPE_INCLUDE_DIRS}" CACHE INTERNAL "")
|
||||
endif()
|
||||
unset(HAVE_BROTLI CACHE)
|
||||
endfunction()
|
||||
|
||||
if(NOT WITH_SYSTEM_FREETYPE)
|
||||
|
||||
Reference in New Issue
Block a user