@@ -805,6 +805,7 @@ class OptionStore:
805805
806806 def __init__ (self , is_cross : bool ) -> None :
807807 self .options : T .Dict ['OptionKey' , 'AnyOptionType' ] = {}
808+ self .subprojects : T .Set [str ] = set ()
808809 self .project_options : T .Set [OptionKey ] = set ()
809810 self .module_options : T .Set [OptionKey ] = set ()
810811 from .compilers import all_languages
@@ -889,6 +890,10 @@ def get_value_object_and_value_for(self, key: OptionKey) -> T.Tuple[AnyOptionTyp
889890 computed_value = vobject .validate_value (self .augments [key ])
890891 return (vobject , computed_value )
891892
893+ def option_has_value (self , key : OptionKey , value : ElementaryOptionValues ) -> bool :
894+ vobject , current_value = self .get_value_object_and_value_for (key )
895+ return vobject .validate_value (value ) == current_value
896+
892897 def get_value_for (self , name : 'T.Union[OptionKey, str]' , subproject : T .Optional [str ] = None ) -> ElementaryOptionValues :
893898 if isinstance (name , str ):
894899 key = OptionKey (name , subproject )
@@ -1387,6 +1392,10 @@ def initialize_from_subproject_call(self,
13871392 # merge everything that has been computed above, while giving self.augments priority
13881393 for key , valstr in options .items ():
13891394 if key .subproject != subproject :
1395+ if key .subproject in self .subprojects and not self .option_has_value (key , valstr ):
1396+ mlog .warning ('option {key} is set in subproject {subproject} but has already been processed' )
1397+ continue
1398+
13901399 # Subproject options from project() will be processed when the subproject is found
13911400 self .pending_subproject_options [key ] = valstr
13921401 continue
@@ -1398,6 +1407,8 @@ def initialize_from_subproject_call(self,
13981407 else :
13991408 self .augments [key ] = valstr
14001409
1410+ self .subprojects .add (subproject )
1411+
14011412 def update_project_options (self , project_options : MutableKeyedOptionDictType , subproject : SubProject ) -> None :
14021413 for key , value in project_options .items ():
14031414 if key not in self .options :
0 commit comments