cmake: Memoize include checks

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8478>
This commit is contained in:
L. E. Segovia 2025-02-12 17:10:30 +00:00 committed by GStreamer Marge Bot
parent 593dc0356c
commit c963597525

View file

@ -178,10 +178,17 @@ endmacro()
macro(_gst_filter_missing_directories GST_INCLUDE_DIRS) macro(_gst_filter_missing_directories GST_INCLUDE_DIRS)
set(_gst_include_dirs) set(_gst_include_dirs)
foreach(DIR IN LISTS ${GST_INCLUDE_DIRS}) foreach(DIR IN LISTS ${GST_INCLUDE_DIRS})
if ((IS_DIRECTORY "${DIR}") AND (EXISTS "${DIR}")) string(MAKE_C_IDENTIFIER "${DIR}" _gst_dir_id)
if (DEFINED _gst_exists_${_gst_dir_id})
if (_gst_exists_${_gst_dir_id})
list(APPEND _gst_include_dirs "${DIR}")
endif()
elseif (EXISTS "${DIR}")
list(APPEND _gst_include_dirs "${DIR}") list(APPEND _gst_include_dirs "${DIR}")
set(_gst_exists_${_gst_dir_id} TRUE)
else() else()
message(WARNING "Skipping missing include folder ${DIR}.") message(WARNING "Skipping missing include folder ${DIR}.")
set(_gst_exists_${_gst_dir_id} FALSE)
endif() endif()
endforeach() endforeach()
set(${GST_INCLUDE_DIRS} "${_gst_include_dirs}") set(${GST_INCLUDE_DIRS} "${_gst_include_dirs}")