@@ -4838,6 +4838,7 @@ bool ProjMgrWorker::ProcessGlobalGenerators(ContextItem* selectedContext, const
48384838 string& projectType, StrVec& siblings) {
48394839
48404840 // iterate over contexts with same build and target types
4841+ m_selectedContexts.clear ();
48414842 for (auto & [_, context] : m_contexts) {
48424843 if ((context.type .build != selectedContext->type .build ) ||
48434844 (context.type .target != selectedContext->type .target )) {
@@ -4846,7 +4847,10 @@ bool ProjMgrWorker::ProcessGlobalGenerators(ContextItem* selectedContext, const
48464847 if (!ParseContextLayers (context)) {
48474848 return false ;
48484849 }
4849- if (!ProcessContext (context, false , true , false )) {
4850+ m_selectedContexts.push_back (context.name );
4851+ }
4852+ for (auto & context : m_selectedContexts) {
4853+ if (!ProcessContext (m_contexts.at (context), false , true , false )) {
48504854 return false ;
48514855 }
48524856 }
@@ -4891,14 +4895,16 @@ bool ProjMgrWorker::ProcessGlobalGenerators(ContextItem* selectedContext, const
48914895 if (find (contexts.begin (), contexts.end (), selectedContext->name ) != contexts.end ()) {
48924896 projectType = type;
48934897 siblings = contexts;
4898+ m_selectedContexts = siblings;
48944899 return true ;
48954900 }
48964901 }
48974902 return false ;
48984903}
48994904
49004905bool ProjMgrWorker::ExecuteExtGenerator (std::string& generatorId) {
4901- const string& selectedContextId = m_selectedContexts.front ();
4906+ const StrVec selectedContexts = m_selectedContexts;
4907+ const string selectedContextId = selectedContexts.front ();
49024908 ContextItem* selectedContext = &m_contexts[selectedContextId];
49034909 string projectType;
49044910 StrVec siblings;
@@ -4913,7 +4919,7 @@ bool ProjMgrWorker::ExecuteExtGenerator(std::string& generatorId) {
49134919 siblingProjects.push_back (siblingContextItem->cproject ->name );
49144920 }
49154921 // Check whether selected contexts belong to sibling projects
4916- for (const auto & contextName : m_selectedContexts ) {
4922+ for (const auto & contextName : selectedContexts ) {
49174923 ContextItem* selectedContextItem = &m_contexts[contextName];
49184924 if (find (siblingProjects.begin (), siblingProjects.end (), selectedContextItem->cproject ->name ) == siblingProjects.end ()) {
49194925 ProjMgrLogger::Get ().Error (" one or more selected contexts are unrelated, redefine the '--context arg [...]' option" , contextName);
0 commit comments