diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake index fbf7d47aa42..2dbc3e09b71 100644 --- a/build_files/cmake/platform/platform_unix.cmake +++ b/build_files/cmake/platform/platform_unix.cmake @@ -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)