cmake: ignore comments and EXCLUDE_SOURCES in module dependency parsing

This commit is contained in:
faumaray committed 2026-12-03 16:41:08 +03:00
1 parent d51dd171ef
commit 7b3258a450
1 file changed
+5 -2
+5 -2
View File
@@ -68,11 +68,14 @@ if(VOID_ENABLED_MODULES)
list(APPEND _void_selected ${_void_module})
if(EXISTS "${_void_module_file}")
file(READ "${_void_module_file}" _void_text)
# The words after INTERNAL_DEPS up to the next keyword or ')'.
# Drop comments so prose between keywords is never parsed as a
# dependency name, then read the words after INTERNAL_DEPS up to
# the next keyword or ')'.
string(REGEX REPLACE "#[^\n]*" "" _void_text "${_void_text}")
if(_void_text MATCHES "INTERNAL_DEPS([^)]*)")
separate_arguments(_void_words UNIX_COMMAND "${CMAKE_MATCH_1}")
foreach(_void_word IN LISTS _void_words)
if(_void_word MATCHES "^(INTERNAL_DEPS|EXTERNAL_DEPS|OPTIONAL_DEPS|DEPS_WIN32|DEPS_UNIX|OPTIONS_WIN32|OPTIONS_UNIX|EXTRA_HEADERS|EXCLUDE_HEADERS)$")
if(_void_word MATCHES "^(INTERNAL_DEPS|EXTERNAL_DEPS|OPTIONAL_DEPS|DEPS_WIN32|DEPS_UNIX|OPTIONS_WIN32|OPTIONS_UNIX|EXTRA_HEADERS|EXCLUDE_HEADERS|EXCLUDE_SOURCES_WIN32|EXCLUDE_SOURCES_UNIX)$")
break()
endif()
list(APPEND _void_pending ${_void_word})