| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662 | 
							- /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
 
-    file Copyright.txt or https://cmake.org/licensing for details.  */
 
- #include "cmGeneratorExpressionNode.h"
 
- #include <algorithm>
 
- #include <cassert>
 
- #include <cerrno>
 
- #include <cstdlib>
 
- #include <cstring>
 
- #include <functional>
 
- #include <map>
 
- #include <memory>
 
- #include <set>
 
- #include <sstream>
 
- #include <stdexcept>
 
- #include <unordered_map>
 
- #include <utility>
 
- #include <cm/iterator>
 
- #include <cm/optional>
 
- #include <cm/string_view>
 
- #include <cmext/algorithm>
 
- #include <cmext/string_view>
 
- #include "cmsys/RegularExpression.hxx"
 
- #include "cmsys/String.h"
 
- #include "cmCMakePath.h"
 
- #include "cmComputeLinkInformation.h"
 
- #include "cmGeneratorExpression.h"
 
- #include "cmGeneratorExpressionContext.h"
 
- #include "cmGeneratorExpressionDAGChecker.h"
 
- #include "cmGeneratorExpressionEvaluator.h"
 
- #include "cmGeneratorTarget.h"
 
- #include "cmGlobalGenerator.h"
 
- #include "cmLinkItem.h"
 
- #include "cmList.h"
 
- #include "cmLocalGenerator.h"
 
- #include "cmMakefile.h"
 
- #include "cmMessageType.h"
 
- #include "cmOutputConverter.h"
 
- #include "cmPolicies.h"
 
- #include "cmRange.h"
 
- #include "cmStandardLevelResolver.h"
 
- #include "cmState.h"
 
- #include "cmStateSnapshot.h"
 
- #include "cmStateTypes.h"
 
- #include "cmStringAlgorithms.h"
 
- #include "cmSystemTools.h"
 
- #include "cmTarget.h"
 
- #include "cmValue.h"
 
- #include "cmake.h"
 
- std::string cmGeneratorExpressionNode::EvaluateDependentExpression(
 
-   std::string const& prop, cmLocalGenerator* lg,
 
-   cmGeneratorExpressionContext* context, cmGeneratorTarget const* headTarget,
 
-   cmGeneratorExpressionDAGChecker* dagChecker,
 
-   cmGeneratorTarget const* currentTarget)
 
- {
 
-   cmGeneratorExpression ge(*lg->GetCMakeInstance(), context->Backtrace);
 
-   std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
 
-   cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem);
 
-   cge->SetQuiet(context->Quiet);
 
-   std::string result =
 
-     cge->Evaluate(lg, context->Config, headTarget, dagChecker, currentTarget,
 
-                   context->Language);
 
-   if (cge->GetHadContextSensitiveCondition()) {
 
-     context->HadContextSensitiveCondition = true;
 
-   }
 
-   if (cge->GetHadHeadSensitiveCondition()) {
 
-     context->HadHeadSensitiveCondition = true;
 
-   }
 
-   if (cge->GetHadLinkLanguageSensitiveCondition()) {
 
-     context->HadLinkLanguageSensitiveCondition = true;
 
-   }
 
-   return result;
 
- }
 
- static const struct ZeroNode : public cmGeneratorExpressionNode
 
- {
 
-   ZeroNode() {} // NOLINT(modernize-use-equals-default)
 
-   bool GeneratesContent() const override { return false; }
 
-   bool AcceptsArbitraryContentParameter() const override { return true; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& /*parameters*/,
 
-     cmGeneratorExpressionContext* /*context*/,
 
-     GeneratorExpressionContent const* /*content*/,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     return std::string();
 
-   }
 
- } zeroNode;
 
- static const struct OneNode : public cmGeneratorExpressionNode
 
- {
 
-   OneNode() {} // NOLINT(modernize-use-equals-default)
 
-   bool AcceptsArbitraryContentParameter() const override { return true; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* /*context*/,
 
-     GeneratorExpressionContent const* /*content*/,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     return parameters.front();
 
-   }
 
- } oneNode;
 
- static const struct OneNode buildInterfaceNode;
 
- static const struct ZeroNode installInterfaceNode;
 
- static const struct OneNode buildLocalInterfaceNode;
 
- struct BooleanOpNode : public cmGeneratorExpressionNode
 
- {
 
-   BooleanOpNode(char const* op_, char const* successVal_,
 
-                 char const* failureVal_)
 
-     : op(op_)
 
-     , successVal(successVal_)
 
-     , failureVal(failureVal_)
 
-   {
 
-   }
 
-   int NumExpectedParameters() const override { return OneOrMoreParameters; }
 
-   bool ShouldEvaluateNextParameter(std::vector<std::string> const& parameters,
 
-                                    std::string& def_value) const override
 
-   {
 
-     if (!parameters.empty() && parameters.back() == failureVal) {
 
-       def_value = failureVal;
 
-       return false;
 
-     }
 
-     return true;
 
-   }
 
-   std::string Evaluate(std::vector<std::string> const& parameters,
 
-                        cmGeneratorExpressionContext* context,
 
-                        GeneratorExpressionContent const* content,
 
-                        cmGeneratorExpressionDAGChecker*) const override
 
-   {
 
-     for (std::string const& param : parameters) {
 
-       if (param == this->failureVal) {
 
-         return this->failureVal;
 
-       }
 
-       if (param != this->successVal) {
 
-         std::ostringstream e;
 
-         e << "Parameters to $<" << this->op;
 
-         e << "> must resolve to either '0' or '1'.";
 
-         reportError(context, content->GetOriginalExpression(), e.str());
 
-         return std::string();
 
-       }
 
-     }
 
-     return this->successVal;
 
-   }
 
-   char const *const op, *const successVal, *const failureVal;
 
- };
 
- static BooleanOpNode const andNode("AND", "1", "0"), orNode("OR", "0", "1");
 
- static const struct NotNode : public cmGeneratorExpressionNode
 
- {
 
-   NotNode() {} // NOLINT(modernize-use-equals-default)
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     if (parameters.front() != "0" && parameters.front() != "1") {
 
-       reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "$<NOT> parameter must resolve to exactly one '0' or '1' value.");
 
-       return std::string();
 
-     }
 
-     return parameters.front() == "0" ? "1" : "0";
 
-   }
 
- } notNode;
 
- static const struct BoolNode : public cmGeneratorExpressionNode
 
- {
 
-   BoolNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return 1; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* /*context*/,
 
-     GeneratorExpressionContent const* /*content*/,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     return !cmIsOff(parameters.front()) ? "1" : "0";
 
-   }
 
- } boolNode;
 
- static const struct IfNode : public cmGeneratorExpressionNode
 
- {
 
-   IfNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return 3; }
 
-   bool ShouldEvaluateNextParameter(std::vector<std::string> const& parameters,
 
-                                    std::string&) const override
 
-   {
 
-     return (parameters.empty() ||
 
-             parameters[0] != cmStrCat(parameters.size() - 1, ""));
 
-   }
 
-   std::string Evaluate(std::vector<std::string> const& parameters,
 
-                        cmGeneratorExpressionContext* context,
 
-                        GeneratorExpressionContent const* content,
 
-                        cmGeneratorExpressionDAGChecker*) const override
 
-   {
 
-     if (parameters[0] != "1" && parameters[0] != "0") {
 
-       reportError(context, content->GetOriginalExpression(),
 
-                   "First parameter to $<IF> must resolve to exactly one '0' "
 
-                   "or '1' value.");
 
-       return std::string();
 
-     }
 
-     return parameters[0] == "1" ? parameters[1] : parameters[2];
 
-   }
 
- } ifNode;
 
- static const struct StrEqualNode : public cmGeneratorExpressionNode
 
- {
 
-   StrEqualNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return 2; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* /*context*/,
 
-     GeneratorExpressionContent const* /*content*/,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     return parameters.front() == parameters[1] ? "1" : "0";
 
-   }
 
- } strEqualNode;
 
- static const struct EqualNode : public cmGeneratorExpressionNode
 
- {
 
-   EqualNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return 2; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     long numbers[2];
 
-     for (int i = 0; i < 2; ++i) {
 
-       if (!ParameterToLong(parameters[i].c_str(), &numbers[i])) {
 
-         reportError(context, content->GetOriginalExpression(),
 
-                     "$<EQUAL> parameter " + parameters[i] +
 
-                       " is not a valid integer.");
 
-         return {};
 
-       }
 
-     }
 
-     return numbers[0] == numbers[1] ? "1" : "0";
 
-   }
 
-   static bool ParameterToLong(char const* param, long* outResult)
 
-   {
 
-     char const isNegative = param[0] == '-';
 
-     int base = 0;
 
-     if (cmHasLiteralPrefix(param, "0b") || cmHasLiteralPrefix(param, "0B")) {
 
-       base = 2;
 
-       param += 2;
 
-     } else if (cmHasLiteralPrefix(param, "-0b") ||
 
-                cmHasLiteralPrefix(param, "-0B") ||
 
-                cmHasLiteralPrefix(param, "+0b") ||
 
-                cmHasLiteralPrefix(param, "+0B")) {
 
-       base = 2;
 
-       param += 3;
 
-     }
 
-     char* pEnd;
 
-     long result = strtol(param, &pEnd, base);
 
-     if (pEnd == param || *pEnd != '\0' || errno == ERANGE) {
 
-       return false;
 
-     }
 
-     if (isNegative && result > 0) {
 
-       result *= -1;
 
-     }
 
-     *outResult = result;
 
-     return true;
 
-   }
 
- } equalNode;
 
- static const struct InListNode : public cmGeneratorExpressionNode
 
- {
 
-   InListNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return 2; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* /*content*/,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     cmList values;
 
-     cmList checkValues;
 
-     bool check = false;
 
-     switch (context->LG->GetPolicyStatus(cmPolicies::CMP0085)) {
 
-       case cmPolicies::WARN:
 
-         if (parameters.front().empty()) {
 
-           check = true;
 
-           checkValues.assign(parameters[1], cmList::EmptyElements::Yes);
 
-         }
 
-         CM_FALLTHROUGH;
 
-       case cmPolicies::OLD:
 
-         values.assign(parameters[1]);
 
-         if (check && values != checkValues) {
 
-           std::ostringstream e;
 
-           e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0085)
 
-             << "\nSearch Item:\n  \"" << parameters.front()
 
-             << "\"\nList:\n  \"" << parameters[1] << "\"\n";
 
-           context->LG->GetCMakeInstance()->IssueMessage(
 
-             MessageType ::AUTHOR_WARNING, e.str(), context->Backtrace);
 
-           return "0";
 
-         }
 
-         if (values.empty()) {
 
-           return "0";
 
-         }
 
-         break;
 
-       case cmPolicies::NEW:
 
-         values.assign(parameters[1], cmList::EmptyElements::Yes);
 
-         break;
 
-     }
 
-     return values.find(parameters.front()) != cmList::npos ? "1" : "0";
 
-   }
 
- } inListNode;
 
- static const struct FilterNode : public cmGeneratorExpressionNode
 
- {
 
-   FilterNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return 3; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     if (parameters.size() != 3) {
 
-       reportError(context, content->GetOriginalExpression(),
 
-                   "$<FILTER:...> expression requires three parameters");
 
-       return {};
 
-     }
 
-     if (parameters[1] != "INCLUDE" && parameters[1] != "EXCLUDE") {
 
-       reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "$<FILTER:...> second parameter must be either INCLUDE or EXCLUDE");
 
-       return {};
 
-     }
 
-     try {
 
-       return cmList{ parameters.front(), cmList::EmptyElements::Yes }
 
-         .filter(parameters[2],
 
-                 parameters[1] == "EXCLUDE" ? cmList::FilterMode::EXCLUDE
 
-                                            : cmList::FilterMode::INCLUDE)
 
-         .to_string();
 
-     } catch (std::invalid_argument&) {
 
-       reportError(context, content->GetOriginalExpression(),
 
-                   "$<FILTER:...> failed to compile regex");
 
-       return {};
 
-     }
 
-   }
 
- } filterNode;
 
- static const struct RemoveDuplicatesNode : public cmGeneratorExpressionNode
 
- {
 
-   RemoveDuplicatesNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return 1; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     if (parameters.size() != 1) {
 
-       reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "$<REMOVE_DUPLICATES:...> expression requires one parameter");
 
-     }
 
-     return cmList{ parameters.front(), cmList::EmptyElements::Yes }
 
-       .remove_duplicates()
 
-       .to_string();
 
-   }
 
- } removeDuplicatesNode;
 
- static const struct TargetExistsNode : public cmGeneratorExpressionNode
 
- {
 
-   TargetExistsNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return 1; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     if (parameters.size() != 1) {
 
-       reportError(context, content->GetOriginalExpression(),
 
-                   "$<TARGET_EXISTS:...> expression requires one parameter");
 
-       return std::string();
 
-     }
 
-     std::string const& targetName = parameters.front();
 
-     if (targetName.empty() ||
 
-         !cmGeneratorExpression::IsValidTargetName(targetName)) {
 
-       reportError(context, content->GetOriginalExpression(),
 
-                   "$<TARGET_EXISTS:tgt> expression requires a non-empty "
 
-                   "valid target name.");
 
-       return std::string();
 
-     }
 
-     return context->LG->GetMakefile()->FindTargetToUse(targetName) ? "1" : "0";
 
-   }
 
- } targetExistsNode;
 
- static const struct TargetNameIfExistsNode : public cmGeneratorExpressionNode
 
- {
 
-   TargetNameIfExistsNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return 1; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     if (parameters.size() != 1) {
 
-       reportError(context, content->GetOriginalExpression(),
 
-                   "$<TARGET_NAME_IF_EXISTS:...> expression requires one "
 
-                   "parameter");
 
-       return std::string();
 
-     }
 
-     std::string const& targetName = parameters.front();
 
-     if (targetName.empty() ||
 
-         !cmGeneratorExpression::IsValidTargetName(targetName)) {
 
-       reportError(context, content->GetOriginalExpression(),
 
-                   "$<TARGET_NAME_IF_EXISTS:tgt> expression requires a "
 
-                   "non-empty valid target name.");
 
-       return std::string();
 
-     }
 
-     return context->LG->GetMakefile()->FindTargetToUse(targetName)
 
-       ? targetName
 
-       : std::string();
 
-   }
 
- } targetNameIfExistsNode;
 
- struct GenexEvaluator : public cmGeneratorExpressionNode
 
- {
 
-   GenexEvaluator() {} // NOLINT(modernize-use-equals-default)
 
- protected:
 
-   std::string EvaluateExpression(
 
-     std::string const& genexOperator, std::string const& expression,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* dagCheckerParent) const
 
-   {
 
-     if (context->HeadTarget) {
 
-       cmGeneratorExpressionDAGChecker dagChecker(
 
-         context->Backtrace, context->HeadTarget,
 
-         genexOperator + ":" + expression, content, dagCheckerParent,
 
-         context->LG, context->Config);
 
-       switch (dagChecker.Check()) {
 
-         case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
 
-         case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE: {
 
-           dagChecker.ReportError(context, content->GetOriginalExpression());
 
-           return std::string();
 
-         }
 
-         case cmGeneratorExpressionDAGChecker::ALREADY_SEEN:
 
-         case cmGeneratorExpressionDAGChecker::DAG:
 
-           break;
 
-       }
 
-       return this->EvaluateDependentExpression(
 
-         expression, context->LG, context, context->HeadTarget, &dagChecker,
 
-         context->CurrentTarget);
 
-     }
 
-     return this->EvaluateDependentExpression(
 
-       expression, context->LG, context, context->HeadTarget, dagCheckerParent,
 
-       context->CurrentTarget);
 
-   }
 
- };
 
- static const struct TargetGenexEvalNode : public GenexEvaluator
 
- {
 
-   TargetGenexEvalNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return 2; }
 
-   bool AcceptsArbitraryContentParameter() const override { return true; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* dagCheckerParent) const override
 
-   {
 
-     std::string const& targetName = parameters.front();
 
-     if (targetName.empty() ||
 
-         !cmGeneratorExpression::IsValidTargetName(targetName)) {
 
-       reportError(context, content->GetOriginalExpression(),
 
-                   "$<TARGET_GENEX_EVAL:tgt, ...> expression requires a "
 
-                   "non-empty valid target name.");
 
-       return std::string();
 
-     }
 
-     auto const* target = context->LG->FindGeneratorTargetToUse(targetName);
 
-     if (!target) {
 
-       std::ostringstream e;
 
-       e << "$<TARGET_GENEX_EVAL:tgt, ...> target \"" << targetName
 
-         << "\" not found.";
 
-       reportError(context, content->GetOriginalExpression(), e.str());
 
-       return std::string();
 
-     }
 
-     std::string const& expression = parameters[1];
 
-     if (expression.empty()) {
 
-       return expression;
 
-     }
 
-     // Replace the surrounding context with the named target.
 
-     cmGeneratorExpressionContext targetContext(
 
-       context->LG, context->Config, context->Quiet, target, target,
 
-       context->EvaluateForBuildsystem, context->Backtrace, context->Language);
 
-     return this->EvaluateExpression("TARGET_GENEX_EVAL", expression,
 
-                                     &targetContext, content, dagCheckerParent);
 
-   }
 
- } targetGenexEvalNode;
 
- static const struct GenexEvalNode : public GenexEvaluator
 
- {
 
-   GenexEvalNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return 1; }
 
-   bool AcceptsArbitraryContentParameter() const override { return true; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* dagCheckerParent) const override
 
-   {
 
-     std::string const& expression = parameters[0];
 
-     if (expression.empty()) {
 
-       return expression;
 
-     }
 
-     return this->EvaluateExpression("GENEX_EVAL", expression, context, content,
 
-                                     dagCheckerParent);
 
-   }
 
- } genexEvalNode;
 
- static const struct LowerCaseNode : public cmGeneratorExpressionNode
 
- {
 
-   LowerCaseNode() {} // NOLINT(modernize-use-equals-default)
 
-   bool AcceptsArbitraryContentParameter() const override { return true; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* /*context*/,
 
-     GeneratorExpressionContent const* /*content*/,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     return cmSystemTools::LowerCase(parameters.front());
 
-   }
 
- } lowerCaseNode;
 
- static const struct UpperCaseNode : public cmGeneratorExpressionNode
 
- {
 
-   UpperCaseNode() {} // NOLINT(modernize-use-equals-default)
 
-   bool AcceptsArbitraryContentParameter() const override { return true; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* /*context*/,
 
-     GeneratorExpressionContent const* /*content*/,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     return cmSystemTools::UpperCase(parameters.front());
 
-   }
 
- } upperCaseNode;
 
- namespace {
 
- template <typename Container>
 
- class Range : public cmRange<typename Container::const_iterator>
 
- {
 
- private:
 
-   using Base = cmRange<typename Container::const_iterator>;
 
- public:
 
-   using const_iterator = typename Container::const_iterator;
 
-   using value_type = typename Container::value_type;
 
-   using size_type = typename Container::size_type;
 
-   using difference_type = typename Container::difference_type;
 
-   using const_reference = typename Container::const_reference;
 
-   Range(Container const& container)
 
-     : Base(container.begin(), container.end())
 
-   {
 
-   }
 
-   const_reference operator[](size_type pos) const
 
-   {
 
-     return *(this->begin() + pos);
 
-   }
 
-   const_reference front() const { return *this->begin(); }
 
-   const_reference back() const { return *std::prev(this->end()); }
 
-   Range& advance(difference_type amount) &
 
-   {
 
-     Base::advance(amount);
 
-     return *this;
 
-   }
 
-   Range advance(difference_type amount) &&
 
-   {
 
-     Base::advance(amount);
 
-     return std::move(*this);
 
-   }
 
- };
 
- using Arguments = Range<std::vector<std::string>>;
 
- bool CheckGenExParameters(cmGeneratorExpressionContext* ctx,
 
-                           GeneratorExpressionContent const* cnt,
 
-                           cm::string_view genex, cm::string_view option,
 
-                           std::size_t count, int required = 1,
 
-                           bool exactly = true)
 
- {
 
-   if (static_cast<int>(count) < required ||
 
-       (exactly && static_cast<int>(count) > required)) {
 
-     std::string nbParameters;
 
-     switch (required) {
 
-       case 1:
 
-         nbParameters = "one parameter";
 
-         break;
 
-       case 2:
 
-         nbParameters = "two parameters";
 
-         break;
 
-       case 3:
 
-         nbParameters = "three parameters";
 
-         break;
 
-       case 4:
 
-         nbParameters = "four parameters";
 
-         break;
 
-       default:
 
-         nbParameters = cmStrCat(required, " parameters");
 
-     }
 
-     reportError(ctx, cnt->GetOriginalExpression(),
 
-                 cmStrCat("$<", genex, ':', option, "> expression requires ",
 
-                          (exactly ? "exactly" : "at least"), ' ', nbParameters,
 
-                          '.'));
 
-     return false;
 
-   }
 
-   return true;
 
- };
 
- bool CheckPathParametersEx(cmGeneratorExpressionContext* ctx,
 
-                            GeneratorExpressionContent const* cnt,
 
-                            cm::string_view option, std::size_t count,
 
-                            int required = 1, bool exactly = true)
 
- {
 
-   return CheckGenExParameters(ctx, cnt, "PATH"_s, option, count, required,
 
-                               exactly);
 
- }
 
- bool CheckPathParameters(cmGeneratorExpressionContext* ctx,
 
-                          GeneratorExpressionContent const* cnt,
 
-                          cm::string_view option, Arguments const& args,
 
-                          int required = 1)
 
- {
 
-   return CheckPathParametersEx(ctx, cnt, option, args.size(), required);
 
- };
 
- std::string ToString(bool isTrue)
 
- {
 
-   return isTrue ? "1" : "0";
 
- };
 
- }
 
- static const struct PathNode : public cmGeneratorExpressionNode
 
- {
 
-   PathNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return TwoOrMoreParameters; }
 
-   bool AcceptsArbitraryContentParameter() const override { return true; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     static auto processList =
 
-       [](std::string const& arg,
 
-          std::function<void(std::string&)> transform) -> std::string {
 
-       cmList list{ arg };
 
-       std::for_each(list.begin(), list.end(), std::move(transform));
 
-       return list.to_string();
 
-     };
 
-     static std::unordered_map<
 
-       cm::string_view,
 
-       std::function<std::string(cmGeneratorExpressionContext*,
 
-                                 GeneratorExpressionContent const*,
 
-                                 Arguments&)>>
 
-       pathCommands{
 
-         { "GET_ROOT_NAME"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckPathParameters(ctx, cnt, "GET_ROOT_NAME"_s, args) &&
 
-                 !args.front().empty()) {
 
-               return processList(args.front(), [](std::string& value) {
 
-                 value = cmCMakePath{ value }.GetRootName().String();
 
-               });
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "GET_ROOT_DIRECTORY"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckPathParameters(ctx, cnt, "GET_ROOT_DIRECTORY"_s, args) &&
 
-                 !args.front().empty()) {
 
-               return processList(args.front(), [](std::string& value) {
 
-                 value = cmCMakePath{ value }.GetRootDirectory().String();
 
-               });
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "GET_ROOT_PATH"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckPathParameters(ctx, cnt, "GET_ROOT_PATH"_s, args) &&
 
-                 !args.front().empty()) {
 
-               return processList(args.front(), [](std::string& value) {
 
-                 value = cmCMakePath{ value }.GetRootPath().String();
 
-               });
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "GET_FILENAME"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckPathParameters(ctx, cnt, "GET_FILENAME"_s, args) &&
 
-                 !args.front().empty()) {
 
-               return processList(args.front(), [](std::string& value) {
 
-                 value = cmCMakePath{ value }.GetFileName().String();
 
-               });
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "GET_EXTENSION"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             bool lastOnly = args.front() == "LAST_ONLY"_s;
 
-             if (lastOnly) {
 
-               args.advance(1);
 
-             }
 
-             if (CheckPathParametersEx(ctx, cnt,
 
-                                       lastOnly ? "GET_EXTENSION,LAST_ONLY"_s
 
-                                                : "GET_EXTENSION"_s,
 
-                                       args.size())) {
 
-               if (args.front().empty()) {
 
-                 return std::string{};
 
-               }
 
-               if (lastOnly) {
 
-                 return processList(args.front(), [](std::string& value) {
 
-                   value = cmCMakePath{ value }.GetExtension().String();
 
-                 });
 
-               }
 
-               return processList(args.front(), [](std::string& value) {
 
-                 value = cmCMakePath{ value }.GetWideExtension().String();
 
-               });
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "GET_STEM"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             bool lastOnly = args.front() == "LAST_ONLY"_s;
 
-             if (lastOnly) {
 
-               args.advance(1);
 
-             }
 
-             if (CheckPathParametersEx(
 
-                   ctx, cnt, lastOnly ? "GET_STEM,LAST_ONLY"_s : "GET_STEM"_s,
 
-                   args.size())) {
 
-               if (args.front().empty()) {
 
-                 return std::string{};
 
-               }
 
-               if (lastOnly) {
 
-                 return processList(args.front(), [](std::string& value) {
 
-                   value = cmCMakePath{ value }.GetStem().String();
 
-                 });
 
-               }
 
-               return processList(args.front(), [](std::string& value) {
 
-                 value = cmCMakePath{ value }.GetNarrowStem().String();
 
-               });
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "GET_RELATIVE_PART"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckPathParameters(ctx, cnt, "GET_RELATIVE_PART"_s, args) &&
 
-                 !args.front().empty()) {
 
-               return processList(args.front(), [](std::string& value) {
 
-                 value = cmCMakePath{ value }.GetRelativePath().String();
 
-               });
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "GET_PARENT_PATH"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckPathParameters(ctx, cnt, "GET_PARENT_PATH"_s, args)) {
 
-               return processList(args.front(), [](std::string& value) {
 
-                 value = cmCMakePath{ value }.GetParentPath().String();
 
-               });
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "HAS_ROOT_NAME"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             return CheckPathParameters(ctx, cnt, "HAS_ROOT_NAME"_s, args)
 
-               ? ToString(cmCMakePath{ args.front() }.HasRootName())
 
-               : std::string{ "0" };
 
-           } },
 
-         { "HAS_ROOT_DIRECTORY"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             return CheckPathParameters(ctx, cnt, "HAS_ROOT_DIRECTORY"_s, args)
 
-               ? ToString(cmCMakePath{ args.front() }.HasRootDirectory())
 
-               : std::string{ "0" };
 
-           } },
 
-         { "HAS_ROOT_PATH"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             return CheckPathParameters(ctx, cnt, "HAS_ROOT_PATH"_s, args)
 
-               ? ToString(cmCMakePath{ args.front() }.HasRootPath())
 
-               : std::string{ "0" };
 
-           } },
 
-         { "HAS_FILENAME"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             return CheckPathParameters(ctx, cnt, "HAS_FILENAME"_s, args)
 
-               ? ToString(cmCMakePath{ args.front() }.HasFileName())
 
-               : std::string{ "0" };
 
-           } },
 
-         { "HAS_EXTENSION"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             return CheckPathParameters(ctx, cnt, "HAS_EXTENSION"_s, args) &&
 
-                 !args.front().empty()
 
-               ? ToString(cmCMakePath{ args.front() }.HasExtension())
 
-               : std::string{ "0" };
 
-           } },
 
-         { "HAS_STEM"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             return CheckPathParameters(ctx, cnt, "HAS_STEM"_s, args)
 
-               ? ToString(cmCMakePath{ args.front() }.HasStem())
 
-               : std::string{ "0" };
 
-           } },
 
-         { "HAS_RELATIVE_PART"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             return CheckPathParameters(ctx, cnt, "HAS_RELATIVE_PART"_s, args)
 
-               ? ToString(cmCMakePath{ args.front() }.HasRelativePath())
 
-               : std::string{ "0" };
 
-           } },
 
-         { "HAS_PARENT_PATH"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             return CheckPathParameters(ctx, cnt, "HAS_PARENT_PATH"_s, args)
 
-               ? ToString(cmCMakePath{ args.front() }.HasParentPath())
 
-               : std::string{ "0" };
 
-           } },
 
-         { "IS_ABSOLUTE"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             return CheckPathParameters(ctx, cnt, "IS_ABSOLUTE"_s, args)
 
-               ? ToString(cmCMakePath{ args.front() }.IsAbsolute())
 
-               : std::string{ "0" };
 
-           } },
 
-         { "IS_RELATIVE"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             return CheckPathParameters(ctx, cnt, "IS_RELATIVE"_s, args)
 
-               ? ToString(cmCMakePath{ args.front() }.IsRelative())
 
-               : std::string{ "0" };
 
-           } },
 
-         { "IS_PREFIX"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             bool normalize = args.front() == "NORMALIZE"_s;
 
-             if (normalize) {
 
-               args.advance(1);
 
-             }
 
-             if (CheckPathParametersEx(ctx, cnt,
 
-                                       normalize ? "IS_PREFIX,NORMALIZE"_s
 
-                                                 : "IS_PREFIX"_s,
 
-                                       args.size(), 2)) {
 
-               if (normalize) {
 
-                 return ToString(cmCMakePath{ args[0] }.Normal().IsPrefix(
 
-                   cmCMakePath{ args[1] }.Normal()));
 
-               }
 
-               return ToString(
 
-                 cmCMakePath{ args[0] }.IsPrefix(cmCMakePath{ args[1] }));
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "CMAKE_PATH"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             bool normalize = args.front() == "NORMALIZE"_s;
 
-             if (normalize) {
 
-               args.advance(1);
 
-             }
 
-             if (CheckPathParametersEx(ctx, cnt,
 
-                                       normalize ? "CMAKE_PATH,NORMALIZE"_s
 
-                                                 : "CMAKE_PATH"_s,
 
-                                       args.size(), 1)) {
 
-               return processList(
 
-                 args.front(), [normalize](std::string& value) {
 
-                   auto path = cmCMakePath{ value, cmCMakePath::auto_format };
 
-                   value = normalize ? path.Normal().GenericString()
 
-                                     : path.GenericString();
 
-                 });
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "NATIVE_PATH"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             bool normalize = args.front() == "NORMALIZE"_s;
 
-             if (normalize) {
 
-               args.advance(1);
 
-             }
 
-             if (CheckPathParametersEx(ctx, cnt,
 
-                                       normalize ? "NATIVE_PATH,NORMALIZE"_s
 
-                                                 : "NATIVE_PATH"_s,
 
-                                       args.size(), 1)) {
 
-               return processList(
 
-                 args.front(), [normalize](std::string& value) {
 
-                   auto path = cmCMakePath{ value };
 
-                   value = normalize ? path.Normal().NativeString()
 
-                                     : path.NativeString();
 
-                 });
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "APPEND"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckPathParametersEx(ctx, cnt, "APPEND"_s, args.size(), 1,
 
-                                       false)) {
 
-               auto const& list = args.front();
 
-               args.advance(1);
 
-               return processList(list, [&args](std::string& value) {
 
-                 cmCMakePath path{ value };
 
-                 for (auto const& p : args) {
 
-                   path /= p;
 
-                 }
 
-                 value = path.String();
 
-               });
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "REMOVE_FILENAME"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckPathParameters(ctx, cnt, "REMOVE_FILENAME"_s, args) &&
 
-                 !args.front().empty()) {
 
-               return processList(args.front(), [](std::string& value) {
 
-                 value = cmCMakePath{ value }.RemoveFileName().String();
 
-               });
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "REPLACE_FILENAME"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckPathParameters(ctx, cnt, "REPLACE_FILENAME"_s, args, 2)) {
 
-               return processList(args.front(), [&args](std::string& value) {
 
-                 value = cmCMakePath{ value }
 
-                           .ReplaceFileName(cmCMakePath{ args[1] })
 
-                           .String();
 
-               });
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "REMOVE_EXTENSION"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             bool lastOnly = args.front() == "LAST_ONLY"_s;
 
-             if (lastOnly) {
 
-               args.advance(1);
 
-             }
 
-             if (CheckPathParametersEx(ctx, cnt,
 
-                                       lastOnly ? "REMOVE_EXTENSION,LAST_ONLY"_s
 
-                                                : "REMOVE_EXTENSION"_s,
 
-                                       args.size())) {
 
-               if (args.front().empty()) {
 
-                 return std::string{};
 
-               }
 
-               if (lastOnly) {
 
-                 return processList(args.front(), [](std::string& value) {
 
-                   value = cmCMakePath{ value }.RemoveExtension().String();
 
-                 });
 
-               }
 
-               return processList(args.front(), [](std::string& value) {
 
-                 value = cmCMakePath{ value }.RemoveWideExtension().String();
 
-               });
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "REPLACE_EXTENSION"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             bool lastOnly = args.front() == "LAST_ONLY"_s;
 
-             if (lastOnly) {
 
-               args.advance(1);
 
-             }
 
-             if (CheckPathParametersEx(ctx, cnt,
 
-                                       lastOnly
 
-                                         ? "REPLACE_EXTENSION,LAST_ONLY"_s
 
-                                         : "REPLACE_EXTENSION"_s,
 
-                                       args.size(), 2)) {
 
-               if (lastOnly) {
 
-                 return processList(args.front(), [&args](std::string& value) {
 
-                   value = cmCMakePath{ value }
 
-                             .ReplaceExtension(cmCMakePath{ args[1] })
 
-                             .String();
 
-                 });
 
-               }
 
-               return processList(args.front(), [&args](std::string& value) {
 
-                 value = cmCMakePath{ value }
 
-                           .ReplaceWideExtension(cmCMakePath{ args[1] })
 
-                           .String();
 
-               });
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "NORMAL_PATH"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckPathParameters(ctx, cnt, "NORMAL_PATH"_s, args) &&
 
-                 !args.front().empty()) {
 
-               return processList(args.front(), [](std::string& value) {
 
-                 value = cmCMakePath{ value }.Normal().String();
 
-               });
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "RELATIVE_PATH"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckPathParameters(ctx, cnt, "RELATIVE_PATH"_s, args, 2)) {
 
-               return processList(args.front(), [&args](std::string& value) {
 
-                 value = cmCMakePath{ value }.Relative(args[1]).String();
 
-               });
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "ABSOLUTE_PATH"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             bool normalize = args.front() == "NORMALIZE"_s;
 
-             if (normalize) {
 
-               args.advance(1);
 
-             }
 
-             if (CheckPathParametersEx(ctx, cnt,
 
-                                       normalize ? "ABSOLUTE_PATH,NORMALIZE"_s
 
-                                                 : "ABSOLUTE_PATH"_s,
 
-                                       args.size(), 2)) {
 
-               return processList(
 
-                 args.front(), [&args, normalize](std::string& value) {
 
-                   auto path = cmCMakePath{ value }.Absolute(args[1]);
 
-                   value = normalize ? path.Normal().String() : path.String();
 
-                 });
 
-             }
 
-             return std::string{};
 
-           } }
 
-       };
 
-     if (cm::contains(pathCommands, parameters.front())) {
 
-       auto args = Arguments{ parameters }.advance(1);
 
-       return pathCommands[parameters.front()](context, content, args);
 
-     }
 
-     reportError(context, content->GetOriginalExpression(),
 
-                 cmStrCat(parameters.front(), ": invalid option."));
 
-     return std::string{};
 
-   }
 
- } pathNode;
 
- static const struct PathEqualNode : public cmGeneratorExpressionNode
 
- {
 
-   PathEqualNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return 2; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* /*context*/,
 
-     GeneratorExpressionContent const* /*content*/,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     return cmCMakePath{ parameters[0] } == cmCMakePath{ parameters[1] } ? "1"
 
-                                                                         : "0";
 
-   }
 
- } pathEqualNode;
 
- namespace {
 
- inline bool CheckListParametersEx(cmGeneratorExpressionContext* ctx,
 
-                                   GeneratorExpressionContent const* cnt,
 
-                                   cm::string_view option, std::size_t count,
 
-                                   int required = 1, bool exactly = true)
 
- {
 
-   return CheckGenExParameters(ctx, cnt, "LIST"_s, option, count, required,
 
-                               exactly);
 
- }
 
- inline bool CheckListParameters(cmGeneratorExpressionContext* ctx,
 
-                                 GeneratorExpressionContent const* cnt,
 
-                                 cm::string_view option, Arguments const& args,
 
-                                 int required = 1)
 
- {
 
-   return CheckListParametersEx(ctx, cnt, option, args.size(), required);
 
- };
 
- inline cmList GetList(std::string const& list)
 
- {
 
-   return list.empty() ? cmList{} : cmList{ list, cmList::EmptyElements::Yes };
 
- }
 
- bool GetNumericArgument(std::string const& arg, cmList::index_type& value)
 
- {
 
-   try {
 
-     std::size_t pos;
 
-     if (sizeof(cmList::index_type) == sizeof(long)) {
 
-       value = std::stol(arg, &pos);
 
-     } else {
 
-       value = std::stoll(arg, &pos);
 
-     }
 
-     if (pos != arg.length()) {
 
-       // this is not a number
 
-       return false;
 
-     }
 
-   } catch (std::invalid_argument const&) {
 
-     return false;
 
-   }
 
-   return true;
 
- }
 
- bool GetNumericArguments(
 
-   cmGeneratorExpressionContext* ctx, GeneratorExpressionContent const* cnt,
 
-   Arguments const& args, std::vector<cmList::index_type>& indexes,
 
-   cmList::ExpandElements expandElements = cmList::ExpandElements::No)
 
- {
 
-   using IndexRange = cmRange<Arguments::const_iterator>;
 
-   IndexRange arguments(args.begin(), args.end());
 
-   cmList list;
 
-   if (expandElements == cmList::ExpandElements::Yes) {
 
-     list = cmList{ args.begin(), args.end(), expandElements };
 
-     arguments = IndexRange{ list.begin(), list.end() };
 
-   }
 
-   for (auto const& value : arguments) {
 
-     cmList::index_type index;
 
-     if (!GetNumericArgument(value, index)) {
 
-       reportError(ctx, cnt->GetOriginalExpression(),
 
-                   cmStrCat("index: \"", value, "\" is not a valid index"));
 
-       return false;
 
-     }
 
-     indexes.push_back(index);
 
-   }
 
-   return true;
 
- }
 
- }
 
- static const struct ListNode : public cmGeneratorExpressionNode
 
- {
 
-   ListNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return TwoOrMoreParameters; }
 
-   bool AcceptsArbitraryContentParameter() const override { return true; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     static std::unordered_map<
 
-       cm::string_view,
 
-       std::function<std::string(cmGeneratorExpressionContext*,
 
-                                 GeneratorExpressionContent const*,
 
-                                 Arguments&)>>
 
-       listCommands{
 
-         { "LENGTH"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckListParameters(ctx, cnt, "LENGTH"_s, args)) {
 
-               return std::to_string(GetList(args.front()).size());
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "GET"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckListParametersEx(ctx, cnt, "GET"_s, args.size(), 2,
 
-                                       false)) {
 
-               auto list = GetList(args.front());
 
-               if (list.empty()) {
 
-                 reportError(ctx, cnt->GetOriginalExpression(),
 
-                             "given empty list");
 
-                 return std::string{};
 
-               }
 
-               std::vector<cmList::index_type> indexes;
 
-               if (!GetNumericArguments(ctx, cnt, args.advance(1), indexes,
 
-                                        cmList::ExpandElements::Yes)) {
 
-                 return std::string{};
 
-               }
 
-               try {
 
-                 return list.get_items(indexes.begin(), indexes.end())
 
-                   .to_string();
 
-               } catch (std::out_of_range& e) {
 
-                 reportError(ctx, cnt->GetOriginalExpression(), e.what());
 
-                 return std::string{};
 
-               }
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "JOIN"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckListParameters(ctx, cnt, "JOIN"_s, args, 2)) {
 
-               return GetList(args.front()).join(args[1]);
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "SUBLIST"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckListParameters(ctx, cnt, "SUBLIST"_s, args, 3)) {
 
-               auto list = GetList(args.front());
 
-               if (!list.empty()) {
 
-                 std::vector<cmList::index_type> indexes;
 
-                 if (!GetNumericArguments(ctx, cnt, args.advance(1), indexes)) {
 
-                   return std::string{};
 
-                 }
 
-                 if (indexes[0] < 0) {
 
-                   reportError(ctx, cnt->GetOriginalExpression(),
 
-                               cmStrCat("begin index: ", indexes[0],
 
-                                        " is out of range 0 - ",
 
-                                        list.size() - 1));
 
-                   return std::string{};
 
-                 }
 
-                 if (indexes[1] < -1) {
 
-                   reportError(ctx, cnt->GetOriginalExpression(),
 
-                               cmStrCat("length: ", indexes[1],
 
-                                        " should be -1 or greater"));
 
-                   return std::string{};
 
-                 }
 
-                 try {
 
-                   return list
 
-                     .sublist(static_cast<cmList::size_type>(indexes[0]),
 
-                              static_cast<cmList::size_type>(indexes[1]))
 
-                     .to_string();
 
-                 } catch (std::out_of_range& e) {
 
-                   reportError(ctx, cnt->GetOriginalExpression(), e.what());
 
-                   return std::string{};
 
-                 }
 
-               }
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "FIND"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckListParameters(ctx, cnt, "FIND"_s, args, 2)) {
 
-               auto list = GetList(args.front());
 
-               auto index = list.find(args[1]);
 
-               return index == cmList::npos ? "-1" : std::to_string(index);
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "APPEND"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckListParametersEx(ctx, cnt, "APPEND"_s, args.size(), 2,
 
-                                       false)) {
 
-               auto list = args.front();
 
-               args.advance(1);
 
-               return cmList::append(list, args.begin(), args.end());
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "PREPEND"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckListParametersEx(ctx, cnt, "PREPEND"_s, args.size(), 2,
 
-                                       false)) {
 
-               auto list = args.front();
 
-               args.advance(1);
 
-               return cmList::prepend(list, args.begin(), args.end());
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "INSERT"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckListParametersEx(ctx, cnt, "INSERT"_s, args.size(), 3,
 
-                                       false)) {
 
-               cmList::index_type index;
 
-               if (!GetNumericArgument(args[1], index)) {
 
-                 reportError(
 
-                   ctx, cnt->GetOriginalExpression(),
 
-                   cmStrCat("index: \"", args[1], "\" is not a valid index"));
 
-                 return std::string{};
 
-               }
 
-               try {
 
-                 auto list = GetList(args.front());
 
-                 args.advance(2);
 
-                 list.insert_items(index, args.begin(), args.end(),
 
-                                   cmList::ExpandElements::No,
 
-                                   cmList::EmptyElements::Yes);
 
-                 return list.to_string();
 
-               } catch (std::out_of_range& e) {
 
-                 reportError(ctx, cnt->GetOriginalExpression(), e.what());
 
-                 return std::string{};
 
-               }
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "POP_BACK"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckListParameters(ctx, cnt, "POP_BACK"_s, args)) {
 
-               auto list = GetList(args.front());
 
-               if (!list.empty()) {
 
-                 list.pop_back();
 
-                 return list.to_string();
 
-               }
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "POP_FRONT"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckListParameters(ctx, cnt, "POP_FRONT"_s, args)) {
 
-               auto list = GetList(args.front());
 
-               if (!list.empty()) {
 
-                 list.pop_front();
 
-                 return list.to_string();
 
-               }
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "REMOVE_DUPLICATES"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckListParameters(ctx, cnt, "REMOVE_DUPLICATES"_s, args)) {
 
-               return GetList(args.front()).remove_duplicates().to_string();
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "REMOVE_ITEM"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckListParametersEx(ctx, cnt, "REMOVE_ITEM"_s, args.size(),
 
-                                       2, false)) {
 
-               auto list = GetList(args.front());
 
-               args.advance(1);
 
-               cmList items{ args.begin(), args.end(),
 
-                             cmList::ExpandElements::Yes };
 
-               return list.remove_items(items.begin(), items.end()).to_string();
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "REMOVE_AT"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckListParametersEx(ctx, cnt, "REMOVE_AT"_s, args.size(), 2,
 
-                                       false)) {
 
-               auto list = GetList(args.front());
 
-               std::vector<cmList::index_type> indexes;
 
-               if (!GetNumericArguments(ctx, cnt, args.advance(1), indexes,
 
-                                        cmList::ExpandElements::Yes)) {
 
-                 return std::string{};
 
-               }
 
-               try {
 
-                 return list.remove_items(indexes.begin(), indexes.end())
 
-                   .to_string();
 
-               } catch (std::out_of_range& e) {
 
-                 reportError(ctx, cnt->GetOriginalExpression(), e.what());
 
-                 return std::string{};
 
-               }
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "FILTER"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckListParameters(ctx, cnt, "FILTER"_s, args, 3)) {
 
-               auto const& op = args[1];
 
-               if (op != "INCLUDE"_s && op != "EXCLUDE"_s) {
 
-                 reportError(
 
-                   ctx, cnt->GetOriginalExpression(),
 
-                   cmStrCat("sub-command FILTER does not recognize operator \"",
 
-                            op, "\". It must be either INCLUDE or EXCLUDE."));
 
-                 return std::string{};
 
-               }
 
-               try {
 
-                 return GetList(args.front())
 
-                   .filter(args[2],
 
-                           op == "INCLUDE"_s ? cmList::FilterMode::INCLUDE
 
-                                             : cmList::FilterMode::EXCLUDE)
 
-                   .to_string();
 
-               } catch (std::invalid_argument&) {
 
-                 reportError(
 
-                   ctx, cnt->GetOriginalExpression(),
 
-                   cmStrCat("sub-command FILTER, failed to compile regex \"",
 
-                            args[2], "\"."));
 
-                 return std::string{};
 
-               }
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "TRANSFORM"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckListParametersEx(ctx, cnt, "TRANSFORM"_s, args.size(), 2,
 
-                                       false)) {
 
-               auto list = GetList(args.front());
 
-               if (!list.empty()) {
 
-                 struct ActionDescriptor
 
-                 {
 
-                   ActionDescriptor(std::string name)
 
-                     : Name(std::move(name))
 
-                   {
 
-                   }
 
-                   ActionDescriptor(std::string name,
 
-                                    cmList::TransformAction action, int arity)
 
-                     : Name(std::move(name))
 
-                     , Action(action)
 
-                     , Arity(arity)
 
-                   {
 
-                   }
 
-                   operator std::string const&() const { return this->Name; }
 
-                   std::string Name;
 
-                   cmList::TransformAction Action;
 
-                   int Arity = 0;
 
-                 };
 
-                 static std::set<
 
-                   ActionDescriptor,
 
-                   std::function<bool(std::string const&, std::string const&)>>
 
-                   descriptors{
 
-                     { { "APPEND", cmList::TransformAction::APPEND, 1 },
 
-                       { "PREPEND", cmList::TransformAction::PREPEND, 1 },
 
-                       { "TOUPPER", cmList::TransformAction::TOUPPER, 0 },
 
-                       { "TOLOWER", cmList::TransformAction::TOLOWER, 0 },
 
-                       { "STRIP", cmList::TransformAction::STRIP, 0 },
 
-                       { "REPLACE", cmList::TransformAction::REPLACE, 2 } },
 
-                     [](std::string const& x, std::string const& y) {
 
-                       return x < y;
 
-                     }
 
-                   };
 
-                 auto descriptor = descriptors.find(args.advance(1).front());
 
-                 if (descriptor == descriptors.end()) {
 
-                   reportError(ctx, cnt->GetOriginalExpression(),
 
-                               cmStrCat(" sub-command TRANSFORM, ",
 
-                                        args.front(), " invalid action."));
 
-                   return std::string{};
 
-                 }
 
-                 // Action arguments
 
-                 args.advance(1);
 
-                 if (args.size() < descriptor->Arity) {
 
-                   reportError(ctx, cnt->GetOriginalExpression(),
 
-                               cmStrCat("sub-command TRANSFORM, action ",
 
-                                        descriptor->Name, " expects ",
 
-                                        descriptor->Arity, " argument(s)."));
 
-                   return std::string{};
 
-                 }
 
-                 std::vector<std::string> arguments;
 
-                 if (descriptor->Arity > 0) {
 
-                   arguments = std::vector<std::string>(
 
-                     args.begin(), args.begin() + descriptor->Arity);
 
-                   args.advance(descriptor->Arity);
 
-                 }
 
-                 std::string const REGEX{ "REGEX" };
 
-                 std::string const AT{ "AT" };
 
-                 std::string const FOR{ "FOR" };
 
-                 std::unique_ptr<cmList::TransformSelector> selector;
 
-                 try {
 
-                   // handle optional arguments
 
-                   while (!args.empty()) {
 
-                     if ((args.front() == REGEX || args.front() == AT ||
 
-                          args.front() == FOR) &&
 
-                         selector) {
 
-                       reportError(ctx, cnt->GetOriginalExpression(),
 
-                                   cmStrCat("sub-command TRANSFORM, selector "
 
-                                            "already specified (",
 
-                                            selector->GetTag(), ")."));
 
-                       return std::string{};
 
-                     }
 
-                     // REGEX selector
 
-                     if (args.front() == REGEX) {
 
-                       if (args.advance(1).empty()) {
 
-                         reportError(
 
-                           ctx, cnt->GetOriginalExpression(),
 
-                           "sub-command TRANSFORM, selector REGEX expects "
 
-                           "'regular expression' argument.");
 
-                         return std::string{};
 
-                       }
 
-                       selector = cmList::TransformSelector::New<
 
-                         cmList::TransformSelector::REGEX>(args.front());
 
-                       args.advance(1);
 
-                       continue;
 
-                     }
 
-                     // AT selector
 
-                     if (args.front() == AT) {
 
-                       args.advance(1);
 
-                       // get all specified indexes
 
-                       std::vector<cmList::index_type> indexes;
 
-                       while (!args.empty()) {
 
-                         cmList indexList{ args.front() };
 
-                         for (auto const& index : indexList) {
 
-                           cmList::index_type value;
 
-                           if (!GetNumericArgument(index, value)) {
 
-                             // this is not a number, stop processing
 
-                             reportError(
 
-                               ctx, cnt->GetOriginalExpression(),
 
-                               cmStrCat("sub-command TRANSFORM, selector AT: '",
 
-                                        index, "': unexpected argument."));
 
-                             return std::string{};
 
-                           }
 
-                           indexes.push_back(value);
 
-                         }
 
-                         args.advance(1);
 
-                       }
 
-                       if (indexes.empty()) {
 
-                         reportError(ctx, cnt->GetOriginalExpression(),
 
-                                     "sub-command TRANSFORM, selector AT "
 
-                                     "expects at least one "
 
-                                     "numeric value.");
 
-                         return std::string{};
 
-                       }
 
-                       selector = cmList::TransformSelector::New<
 
-                         cmList::TransformSelector::AT>(std::move(indexes));
 
-                       continue;
 
-                     }
 
-                     // FOR selector
 
-                     if (args.front() == FOR) {
 
-                       if (args.advance(1).size() < 2) {
 
-                         reportError(ctx, cnt->GetOriginalExpression(),
 
-                                     "sub-command TRANSFORM, selector FOR "
 
-                                     "expects, at least,"
 
-                                     " two arguments.");
 
-                         return std::string{};
 
-                       }
 
-                       cmList::index_type start = 0;
 
-                       cmList::index_type stop = 0;
 
-                       cmList::index_type step = 1;
 
-                       bool valid = false;
 
-                       if (GetNumericArgument(args.front(), start) &&
 
-                           GetNumericArgument(args.advance(1).front(), stop)) {
 
-                         valid = true;
 
-                       }
 
-                       if (!valid) {
 
-                         reportError(
 
-                           ctx, cnt->GetOriginalExpression(),
 
-                           "sub-command TRANSFORM, selector FOR expects, "
 
-                           "at least, two numeric values.");
 
-                         return std::string{};
 
-                       }
 
-                       // try to read a third numeric value for step
 
-                       if (!args.advance(1).empty()) {
 
-                         if (!GetNumericArgument(args.front(), step)) {
 
-                           // this is not a number
 
-                           step = -1;
 
-                         }
 
-                         args.advance(1);
 
-                       }
 
-                       if (step <= 0) {
 
-                         reportError(
 
-                           ctx, cnt->GetOriginalExpression(),
 
-                           "sub-command TRANSFORM, selector FOR expects "
 
-                           "positive numeric value for <step>.");
 
-                         return std::string{};
 
-                       }
 
-                       selector = cmList::TransformSelector::New<
 
-                         cmList::TransformSelector::FOR>({ start, stop, step });
 
-                       continue;
 
-                     }
 
-                     reportError(ctx, cnt->GetOriginalExpression(),
 
-                                 cmStrCat("sub-command TRANSFORM, '",
 
-                                          cmJoin(args, ", "),
 
-                                          "': unexpected argument(s)."));
 
-                     return std::string{};
 
-                   }
 
-                   return list
 
-                     .transform(descriptor->Action, arguments,
 
-                                std::move(selector))
 
-                     .to_string();
 
-                 } catch (cmList::transform_error& e) {
 
-                   reportError(ctx, cnt->GetOriginalExpression(), e.what());
 
-                   return std::string{};
 
-                 }
 
-               }
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "REVERSE"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckListParameters(ctx, cnt, "REVERSE"_s, args)) {
 
-               return GetList(args.front()).reverse().to_string();
 
-             }
 
-             return std::string{};
 
-           } },
 
-         { "SORT"_s,
 
-           [](cmGeneratorExpressionContext* ctx,
 
-              GeneratorExpressionContent const* cnt,
 
-              Arguments& args) -> std::string {
 
-             if (CheckListParametersEx(ctx, cnt, "SORT"_s, args.size(), 1,
 
-                                       false)) {
 
-               auto list = GetList(args.front());
 
-               args.advance(1);
 
-               auto const COMPARE = "COMPARE:"_s;
 
-               auto const CASE = "CASE:"_s;
 
-               auto const ORDER = "ORDER:"_s;
 
-               using SortConfig = cmList::SortConfiguration;
 
-               SortConfig sortConfig;
 
-               for (auto const& arg : args) {
 
-                 if (cmHasPrefix(arg, COMPARE)) {
 
-                   if (sortConfig.Compare !=
 
-                       SortConfig::CompareMethod::DEFAULT) {
 
-                     reportError(ctx, cnt->GetOriginalExpression(),
 
-                                 "sub-command SORT, COMPARE option has been "
 
-                                 "specified multiple times.");
 
-                     return std::string{};
 
-                   }
 
-                   auto option =
 
-                     cm::string_view{ arg.c_str() + COMPARE.length() };
 
-                   if (option == "STRING"_s) {
 
-                     sortConfig.Compare = SortConfig::CompareMethod::STRING;
 
-                     continue;
 
-                   }
 
-                   if (option == "FILE_BASENAME"_s) {
 
-                     sortConfig.Compare =
 
-                       SortConfig::CompareMethod::FILE_BASENAME;
 
-                     continue;
 
-                   }
 
-                   if (option == "NATURAL"_s) {
 
-                     sortConfig.Compare = SortConfig::CompareMethod::NATURAL;
 
-                     continue;
 
-                   }
 
-                   reportError(
 
-                     ctx, cnt->GetOriginalExpression(),
 
-                     cmStrCat(
 
-                       "sub-command SORT, an invalid COMPARE option has been "
 
-                       "specified: \"",
 
-                       option, "\"."));
 
-                   return std::string{};
 
-                 }
 
-                 if (cmHasPrefix(arg, CASE)) {
 
-                   if (sortConfig.Case !=
 
-                       SortConfig::CaseSensitivity::DEFAULT) {
 
-                     reportError(ctx, cnt->GetOriginalExpression(),
 
-                                 "sub-command SORT, CASE option has been "
 
-                                 "specified multiple times.");
 
-                     return std::string{};
 
-                   }
 
-                   auto option = cm::string_view{ arg.c_str() + CASE.length() };
 
-                   if (option == "SENSITIVE"_s) {
 
-                     sortConfig.Case = SortConfig::CaseSensitivity::SENSITIVE;
 
-                     continue;
 
-                   }
 
-                   if (option == "INSENSITIVE"_s) {
 
-                     sortConfig.Case = SortConfig::CaseSensitivity::INSENSITIVE;
 
-                     continue;
 
-                   }
 
-                   reportError(
 
-                     ctx, cnt->GetOriginalExpression(),
 
-                     cmStrCat(
 
-                       "sub-command SORT, an invalid CASE option has been "
 
-                       "specified: \"",
 
-                       option, "\"."));
 
-                   return std::string{};
 
-                 }
 
-                 if (cmHasPrefix(arg, ORDER)) {
 
-                   if (sortConfig.Order != SortConfig::OrderMode::DEFAULT) {
 
-                     reportError(ctx, cnt->GetOriginalExpression(),
 
-                                 "sub-command SORT, ORDER option has been "
 
-                                 "specified multiple times.");
 
-                     return std::string{};
 
-                   }
 
-                   auto option =
 
-                     cm::string_view{ arg.c_str() + ORDER.length() };
 
-                   if (option == "ASCENDING"_s) {
 
-                     sortConfig.Order = SortConfig::OrderMode::ASCENDING;
 
-                     continue;
 
-                   }
 
-                   if (option == "DESCENDING"_s) {
 
-                     sortConfig.Order = SortConfig::OrderMode::DESCENDING;
 
-                     continue;
 
-                   }
 
-                   reportError(
 
-                     ctx, cnt->GetOriginalExpression(),
 
-                     cmStrCat(
 
-                       "sub-command SORT, an invalid ORDER option has been "
 
-                       "specified: \"",
 
-                       option, "\"."));
 
-                   return std::string{};
 
-                 }
 
-                 reportError(ctx, cnt->GetOriginalExpression(),
 
-                             cmStrCat("sub-command SORT, option \"", arg,
 
-                                      "\" is invalid."));
 
-                 return std::string{};
 
-               }
 
-               return list.sort(sortConfig).to_string();
 
-             }
 
-             return std::string{};
 
-           } }
 
-       };
 
-     if (cm::contains(listCommands, parameters.front())) {
 
-       auto args = Arguments{ parameters }.advance(1);
 
-       return listCommands[parameters.front()](context, content, args);
 
-     }
 
-     reportError(context, content->GetOriginalExpression(),
 
-                 cmStrCat(parameters.front(), ": invalid option."));
 
-     return std::string{};
 
-   }
 
- } listNode;
 
- static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode
 
- {
 
-   MakeCIdentifierNode() {} // NOLINT(modernize-use-equals-default)
 
-   bool AcceptsArbitraryContentParameter() const override { return true; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* /*context*/,
 
-     GeneratorExpressionContent const* /*content*/,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     return cmSystemTools::MakeCidentifier(parameters.front());
 
-   }
 
- } makeCIdentifierNode;
 
- template <char C>
 
- struct CharacterNode : public cmGeneratorExpressionNode
 
- {
 
-   CharacterNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return 0; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& /*parameters*/,
 
-     cmGeneratorExpressionContext* /*context*/,
 
-     GeneratorExpressionContent const* /*content*/,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     return { C };
 
-   }
 
- };
 
- static CharacterNode<'>'> const angle_rNode;
 
- static CharacterNode<','> const commaNode;
 
- static CharacterNode<';'> const semicolonNode;
 
- static CharacterNode<'"'> const quoteNode;
 
- struct CompilerIdNode : public cmGeneratorExpressionNode
 
- {
 
-   CompilerIdNode(char const* compilerLang)
 
-     : CompilerLanguage(compilerLang)
 
-   {
 
-   }
 
-   int NumExpectedParameters() const override { return ZeroOrMoreParameters; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* dagChecker) const override
 
-   {
 
-     if (!context->HeadTarget) {
 
-       std::ostringstream e;
 
-       e << "$<" << this->CompilerLanguage
 
-         << "_COMPILER_ID> may only be used with binary targets.  It may "
 
-            "not be used with add_custom_command or add_custom_target.";
 
-       reportError(context, content->GetOriginalExpression(), e.str());
 
-       return {};
 
-     }
 
-     return this->EvaluateWithLanguage(parameters, context, content, dagChecker,
 
-                                       this->CompilerLanguage);
 
-   }
 
-   std::string EvaluateWithLanguage(std::vector<std::string> const& parameters,
 
-                                    cmGeneratorExpressionContext* context,
 
-                                    GeneratorExpressionContent const* content,
 
-                                    cmGeneratorExpressionDAGChecker* /*unused*/,
 
-                                    std::string const& lang) const
 
-   {
 
-     std::string const& compilerId =
 
-       context->LG->GetMakefile()->GetSafeDefinition("CMAKE_" + lang +
 
-                                                     "_COMPILER_ID");
 
-     if (parameters.empty()) {
 
-       return compilerId;
 
-     }
 
-     if (compilerId.empty()) {
 
-       return parameters.front().empty() ? "1" : "0";
 
-     }
 
-     static cmsys::RegularExpression compilerIdValidator("^[A-Za-z0-9_]*$");
 
-     for (auto const& param : parameters) {
 
-       if (!compilerIdValidator.find(param)) {
 
-         reportError(context, content->GetOriginalExpression(),
 
-                     "Expression syntax not recognized.");
 
-         return std::string();
 
-       }
 
-       if (strcmp(param.c_str(), compilerId.c_str()) == 0) {
 
-         return "1";
 
-       }
 
-     }
 
-     return "0";
 
-   }
 
-   char const* const CompilerLanguage;
 
- };
 
- static CompilerIdNode const cCompilerIdNode("C"), cxxCompilerIdNode("CXX"),
 
-   cudaCompilerIdNode("CUDA"), objcCompilerIdNode("OBJC"),
 
-   objcxxCompilerIdNode("OBJCXX"), fortranCompilerIdNode("Fortran"),
 
-   hipCompilerIdNode("HIP"), ispcCompilerIdNode("ISPC");
 
- struct CompilerVersionNode : public cmGeneratorExpressionNode
 
- {
 
-   CompilerVersionNode(char const* compilerLang)
 
-     : CompilerLanguage(compilerLang)
 
-   {
 
-   }
 
-   int NumExpectedParameters() const override { return OneOrZeroParameters; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* dagChecker) const override
 
-   {
 
-     if (!context->HeadTarget) {
 
-       std::ostringstream e;
 
-       e << "$<" << this->CompilerLanguage
 
-         << "_COMPILER_VERSION> may only be used with binary targets.  It "
 
-            "may not be used with add_custom_command or add_custom_target.";
 
-       reportError(context, content->GetOriginalExpression(), e.str());
 
-       return {};
 
-     }
 
-     return this->EvaluateWithLanguage(parameters, context, content, dagChecker,
 
-                                       this->CompilerLanguage);
 
-   }
 
-   std::string EvaluateWithLanguage(std::vector<std::string> const& parameters,
 
-                                    cmGeneratorExpressionContext* context,
 
-                                    GeneratorExpressionContent const* content,
 
-                                    cmGeneratorExpressionDAGChecker* /*unused*/,
 
-                                    std::string const& lang) const
 
-   {
 
-     std::string const& compilerVersion =
 
-       context->LG->GetMakefile()->GetSafeDefinition("CMAKE_" + lang +
 
-                                                     "_COMPILER_VERSION");
 
-     if (parameters.empty()) {
 
-       return compilerVersion;
 
-     }
 
-     static cmsys::RegularExpression compilerIdValidator("^[0-9\\.]*$");
 
-     if (!compilerIdValidator.find(parameters.front())) {
 
-       reportError(context, content->GetOriginalExpression(),
 
-                   "Expression syntax not recognized.");
 
-       return {};
 
-     }
 
-     if (compilerVersion.empty()) {
 
-       return parameters.front().empty() ? "1" : "0";
 
-     }
 
-     return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL,
 
-                                          parameters.front(), compilerVersion)
 
-       ? "1"
 
-       : "0";
 
-   }
 
-   char const* const CompilerLanguage;
 
- };
 
- static CompilerVersionNode const cCompilerVersionNode("C"),
 
-   cxxCompilerVersionNode("CXX"), cudaCompilerVersionNode("CUDA"),
 
-   objcCompilerVersionNode("OBJC"), objcxxCompilerVersionNode("OBJCXX"),
 
-   fortranCompilerVersionNode("Fortran"), ispcCompilerVersionNode("ISPC"),
 
-   hipCompilerVersionNode("HIP");
 
- struct CompilerFrontendVariantNode : public cmGeneratorExpressionNode
 
- {
 
-   CompilerFrontendVariantNode(char const* compilerLang)
 
-     : CompilerLanguage(compilerLang)
 
-   {
 
-   }
 
-   int NumExpectedParameters() const override { return ZeroOrMoreParameters; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* dagChecker) const override
 
-   {
 
-     if (!context->HeadTarget) {
 
-       std::ostringstream e;
 
-       e << "$<" << this->CompilerLanguage
 
-         << "_COMPILER_FRONTEND_VARIANT> may only be used with binary targets. "
 
-            " It may not be used with add_custom_command or add_custom_target.";
 
-       reportError(context, content->GetOriginalExpression(), e.str());
 
-       return {};
 
-     }
 
-     return this->EvaluateWithLanguage(parameters, context, content, dagChecker,
 
-                                       this->CompilerLanguage);
 
-   }
 
-   std::string EvaluateWithLanguage(std::vector<std::string> const& parameters,
 
-                                    cmGeneratorExpressionContext* context,
 
-                                    GeneratorExpressionContent const* content,
 
-                                    cmGeneratorExpressionDAGChecker* /*unused*/,
 
-                                    std::string const& lang) const
 
-   {
 
-     std::string const& compilerFrontendVariant =
 
-       context->LG->GetMakefile()->GetSafeDefinition(
 
-         "CMAKE_" + lang + "_COMPILER_FRONTEND_VARIANT");
 
-     if (parameters.empty()) {
 
-       return compilerFrontendVariant;
 
-     }
 
-     if (compilerFrontendVariant.empty()) {
 
-       return parameters.front().empty() ? "1" : "0";
 
-     }
 
-     static cmsys::RegularExpression compilerFrontendVariantValidator(
 
-       "^[A-Za-z0-9_]*$");
 
-     for (auto const& param : parameters) {
 
-       if (!compilerFrontendVariantValidator.find(param)) {
 
-         reportError(context, content->GetOriginalExpression(),
 
-                     "Expression syntax not recognized.");
 
-         return {};
 
-       }
 
-       if (strcmp(param.c_str(), compilerFrontendVariant.c_str()) == 0) {
 
-         return "1";
 
-       }
 
-     }
 
-     return "0";
 
-   }
 
-   char const* const CompilerLanguage;
 
- };
 
- static CompilerFrontendVariantNode const cCompilerFrontendVariantNode("C"),
 
-   cxxCompilerFrontendVariantNode("CXX"),
 
-   cudaCompilerFrontendVariantNode("CUDA"),
 
-   objcCompilerFrontendVariantNode("OBJC"),
 
-   objcxxCompilerFrontendVariantNode("OBJCXX"),
 
-   fortranCompilerFrontendVariantNode("Fortran"),
 
-   hipCompilerFrontendVariantNode("HIP"),
 
-   ispcCompilerFrontendVariantNode("ISPC");
 
- struct PlatformIdNode : public cmGeneratorExpressionNode
 
- {
 
-   PlatformIdNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return ZeroOrMoreParameters; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* /*content*/,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     std::string const& platformId =
 
-       context->LG->GetMakefile()->GetSafeDefinition("CMAKE_SYSTEM_NAME");
 
-     if (parameters.empty()) {
 
-       return platformId;
 
-     }
 
-     if (platformId.empty()) {
 
-       return parameters.front().empty() ? "1" : "0";
 
-     }
 
-     for (auto const& param : parameters) {
 
-       if (param == platformId) {
 
-         return "1";
 
-       }
 
-     }
 
-     return "0";
 
-   }
 
- };
 
- static struct PlatformIdNode platformIdNode;
 
- template <cmSystemTools::CompareOp Op>
 
- struct VersionNode : public cmGeneratorExpressionNode
 
- {
 
-   VersionNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return 2; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* /*context*/,
 
-     GeneratorExpressionContent const* /*content*/,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     return cmSystemTools::VersionCompare(Op, parameters.front(), parameters[1])
 
-       ? "1"
 
-       : "0";
 
-   }
 
- };
 
- static VersionNode<cmSystemTools::OP_GREATER> const versionGreaterNode;
 
- static VersionNode<cmSystemTools::OP_GREATER_EQUAL> const versionGreaterEqNode;
 
- static VersionNode<cmSystemTools::OP_LESS> const versionLessNode;
 
- static VersionNode<cmSystemTools::OP_LESS_EQUAL> const versionLessEqNode;
 
- static VersionNode<cmSystemTools::OP_EQUAL> const versionEqualNode;
 
- static const struct CompileOnlyNode : public cmGeneratorExpressionNode
 
- {
 
-   CompileOnlyNode() {} // NOLINT(modernize-use-equals-default)
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* dagChecker) const override
 
-   {
 
-     if (!dagChecker) {
 
-       reportError(context, content->GetOriginalExpression(),
 
-                   "$<COMPILE_ONLY:...> may only be used for linking");
 
-       return std::string();
 
-     }
 
-     if (dagChecker->GetTransitivePropertiesOnly()) {
 
-       return parameters.front();
 
-     }
 
-     return std::string{};
 
-   }
 
- } compileOnlyNode;
 
- static const struct LinkOnlyNode : public cmGeneratorExpressionNode
 
- {
 
-   LinkOnlyNode() {} // NOLINT(modernize-use-equals-default)
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* dagChecker) const override
 
-   {
 
-     if (!dagChecker) {
 
-       reportError(context, content->GetOriginalExpression(),
 
-                   "$<LINK_ONLY:...> may only be used for linking");
 
-       return std::string();
 
-     }
 
-     if (!dagChecker->GetTransitivePropertiesOnlyCMP0131()) {
 
-       return parameters.front();
 
-     }
 
-     return std::string();
 
-   }
 
- } linkOnlyNode;
 
- static const struct ConfigurationNode : public cmGeneratorExpressionNode
 
- {
 
-   ConfigurationNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return 0; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& /*parameters*/,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* /*content*/,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     context->HadContextSensitiveCondition = true;
 
-     return context->Config;
 
-   }
 
- } configurationNode;
 
- static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
 
- {
 
-   ConfigurationTestNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return ZeroOrMoreParameters; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     if (parameters.empty()) {
 
-       return configurationNode.Evaluate(parameters, context, content, nullptr);
 
-     }
 
-     static cmsys::RegularExpression configValidator("^[A-Za-z0-9_]*$");
 
-     if (!configValidator.find(parameters.front())) {
 
-     }
 
-     context->HadContextSensitiveCondition = true;
 
-     bool firstParam = true;
 
-     for (auto const& param : parameters) {
 
-       if (!configValidator.find(param)) {
 
-         if (firstParam) {
 
-           reportError(context, content->GetOriginalExpression(),
 
-                       "Expression syntax not recognized.");
 
-           return std::string();
 
-         }
 
-         // for backwards compat invalid config names are only errors as
 
-         // the first parameter
 
-         std::ostringstream e;
 
-         /* clang-format off */
 
-         e << "Warning evaluating generator expression:\n"
 
-           << "  " << content->GetOriginalExpression() << "\n"
 
-           << "The config name of \"" << param << "\" is invalid";
 
-         /* clang-format on */
 
-         context->LG->GetCMakeInstance()->IssueMessage(
 
-           MessageType::WARNING, e.str(), context->Backtrace);
 
-       }
 
-       firstParam = false;
 
-       if (context->Config.empty()) {
 
-         if (param.empty()) {
 
-           return "1";
 
-         }
 
-       } else if (cmsysString_strcasecmp(param.c_str(),
 
-                                         context->Config.c_str()) == 0) {
 
-         return "1";
 
-       }
 
-     }
 
-     if (context->CurrentTarget && context->CurrentTarget->IsImported()) {
 
-       cmValue loc = nullptr;
 
-       cmValue imp = nullptr;
 
-       std::string suffix;
 
-       if (context->CurrentTarget->Target->GetMappedConfig(context->Config, loc,
 
-                                                           imp, suffix)) {
 
-         // This imported target has an appropriate location
 
-         // for this (possibly mapped) config.
 
-         // Check if there is a proper config mapping for the tested config.
 
-         cmList mappedConfigs;
 
-         std::string mapProp = cmStrCat(
 
-           "MAP_IMPORTED_CONFIG_", cmSystemTools::UpperCase(context->Config));
 
-         if (cmValue mapValue = context->CurrentTarget->GetProperty(mapProp)) {
 
-           mappedConfigs.assign(cmSystemTools::UpperCase(*mapValue));
 
-           for (auto const& param : parameters) {
 
-             if (cm::contains(mappedConfigs, cmSystemTools::UpperCase(param))) {
 
-               return "1";
 
-             }
 
-           }
 
-         } else if (!suffix.empty()) {
 
-           // There is no explicit mapping for the tested config, so use
 
-           // the configuration of the imported location that was selected.
 
-           for (auto const& param : parameters) {
 
-             if (cmStrCat('_', cmSystemTools::UpperCase(param)) == suffix) {
 
-               return "1";
 
-             }
 
-           }
 
-         }
 
-       }
 
-     }
 
-     return "0";
 
-   }
 
- } configurationTestNode;
 
- static const struct JoinNode : public cmGeneratorExpressionNode
 
- {
 
-   JoinNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return 2; }
 
-   bool AcceptsArbitraryContentParameter() const override { return true; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* /*context*/,
 
-     GeneratorExpressionContent const* /*content*/,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     return cmList{ parameters.front() }.join(parameters[1]);
 
-   }
 
- } joinNode;
 
- static const struct CompileLanguageNode : public cmGeneratorExpressionNode
 
- {
 
-   CompileLanguageNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return ZeroOrMoreParameters; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* dagChecker) const override
 
-   {
 
-     if (context->Language.empty() &&
 
-         (!dagChecker || !dagChecker->EvaluatingCompileExpression())) {
 
-       reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "$<COMPILE_LANGUAGE:...> may only be used to specify include "
 
-         "directories, compile definitions, compile options, and to evaluate "
 
-         "components of the file(GENERATE) command.");
 
-       return std::string();
 
-     }
 
-     cmGlobalGenerator* gg = context->LG->GetGlobalGenerator();
 
-     std::string genName = gg->GetName();
 
-     if (genName.find("Makefiles") == std::string::npos &&
 
-         genName.find("Ninja") == std::string::npos &&
 
-         genName.find("Visual Studio") == std::string::npos &&
 
-         genName.find("Xcode") == std::string::npos &&
 
-         genName.find("Watcom WMake") == std::string::npos &&
 
-         genName.find("Green Hills MULTI") == std::string::npos) {
 
-       reportError(context, content->GetOriginalExpression(),
 
-                   "$<COMPILE_LANGUAGE:...> not supported for this generator.");
 
-       return std::string();
 
-     }
 
-     if (parameters.empty()) {
 
-       return context->Language;
 
-     }
 
-     for (auto const& param : parameters) {
 
-       if (context->Language == param) {
 
-         return "1";
 
-       }
 
-     }
 
-     return "0";
 
-   }
 
- } languageNode;
 
- static const struct CompileLanguageAndIdNode : public cmGeneratorExpressionNode
 
- {
 
-   CompileLanguageAndIdNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return TwoOrMoreParameters; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* dagChecker) const override
 
-   {
 
-     if (!context->HeadTarget ||
 
-         (context->Language.empty() &&
 
-          (!dagChecker || !dagChecker->EvaluatingCompileExpression()))) {
 
-       // reportError(context, content->GetOriginalExpression(), "");
 
-       reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "$<COMPILE_LANG_AND_ID:lang,id> may only be used with binary "
 
-         "targets "
 
-         "to specify include directories, compile definitions, and compile "
 
-         "options.  It may not be used with the add_custom_command, "
 
-         "add_custom_target, or file(GENERATE) commands.");
 
-       return std::string();
 
-     }
 
-     cmGlobalGenerator* gg = context->LG->GetGlobalGenerator();
 
-     std::string genName = gg->GetName();
 
-     if (genName.find("Makefiles") == std::string::npos &&
 
-         genName.find("Ninja") == std::string::npos &&
 
-         genName.find("Visual Studio") == std::string::npos &&
 
-         genName.find("Xcode") == std::string::npos &&
 
-         genName.find("Watcom WMake") == std::string::npos &&
 
-         genName.find("Green Hills MULTI") == std::string::npos) {
 
-       reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "$<COMPILE_LANG_AND_ID:lang,id> not supported for this generator.");
 
-       return std::string();
 
-     }
 
-     std::string const& lang = context->Language;
 
-     if (lang == parameters.front()) {
 
-       std::vector<std::string> idParameter((parameters.cbegin() + 1),
 
-                                            parameters.cend());
 
-       return CompilerIdNode{ lang.c_str() }.EvaluateWithLanguage(
 
-         idParameter, context, content, dagChecker, lang);
 
-     }
 
-     return "0";
 
-   }
 
- } languageAndIdNode;
 
- static const struct LinkLanguageNode : public cmGeneratorExpressionNode
 
- {
 
-   LinkLanguageNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return ZeroOrMoreParameters; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* dagChecker) const override
 
-   {
 
-     if (!context->HeadTarget || !dagChecker ||
 
-         !(dagChecker->EvaluatingLinkExpression() ||
 
-           dagChecker->EvaluatingLinkLibraries() ||
 
-           dagChecker->EvaluatingLinkerLauncher())) {
 
-       reportError(context, content->GetOriginalExpression(),
 
-                   "$<LINK_LANGUAGE:...> may only be used with binary targets "
 
-                   "to specify link libraries, link directories, link options "
 
-                   "and link depends.");
 
-       return std::string();
 
-     }
 
-     if (dagChecker->EvaluatingLinkLibraries() && parameters.empty()) {
 
-       reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "$<LINK_LANGUAGE> is not supported in link libraries expression.");
 
-       return std::string();
 
-     }
 
-     cmGlobalGenerator* gg = context->LG->GetGlobalGenerator();
 
-     std::string genName = gg->GetName();
 
-     if (genName.find("Makefiles") == std::string::npos &&
 
-         genName.find("Ninja") == std::string::npos &&
 
-         genName.find("Visual Studio") == std::string::npos &&
 
-         genName.find("Xcode") == std::string::npos &&
 
-         genName.find("Watcom WMake") == std::string::npos &&
 
-         genName.find("Green Hills MULTI") == std::string::npos) {
 
-       reportError(context, content->GetOriginalExpression(),
 
-                   "$<LINK_LANGUAGE:...> not supported for this generator.");
 
-       return std::string();
 
-     }
 
-     if (dagChecker->EvaluatingLinkLibraries()) {
 
-       context->HadHeadSensitiveCondition = true;
 
-       context->HadLinkLanguageSensitiveCondition = true;
 
-     }
 
-     if (parameters.empty()) {
 
-       return context->Language;
 
-     }
 
-     for (auto const& param : parameters) {
 
-       if (context->Language == param) {
 
-         return "1";
 
-       }
 
-     }
 
-     return "0";
 
-   }
 
- } linkLanguageNode;
 
- namespace {
 
- struct LinkerId
 
- {
 
-   static std::string Evaluate(std::vector<std::string> const& parameters,
 
-                               cmGeneratorExpressionContext* context,
 
-                               GeneratorExpressionContent const* content,
 
-                               std::string const& lang)
 
-   {
 
-     std::string const& linkerId =
 
-       context->LG->GetMakefile()->GetSafeDefinition("CMAKE_" + lang +
 
-                                                     "_COMPILER_ID");
 
-     if (parameters.empty()) {
 
-       return linkerId;
 
-     }
 
-     if (linkerId.empty()) {
 
-       return parameters.front().empty() ? "1" : "0";
 
-     }
 
-     static cmsys::RegularExpression linkerIdValidator("^[A-Za-z0-9_]*$");
 
-     for (auto const& param : parameters) {
 
-       if (!linkerIdValidator.find(param)) {
 
-         reportError(context, content->GetOriginalExpression(),
 
-                     "Expression syntax not recognized.");
 
-         return std::string();
 
-       }
 
-       if (param == linkerId) {
 
-         return "1";
 
-       }
 
-     }
 
-     return "0";
 
-   }
 
- };
 
- }
 
- static const struct LinkLanguageAndIdNode : public cmGeneratorExpressionNode
 
- {
 
-   LinkLanguageAndIdNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return TwoOrMoreParameters; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* dagChecker) const override
 
-   {
 
-     if (!context->HeadTarget || !dagChecker ||
 
-         !(dagChecker->EvaluatingLinkExpression() ||
 
-           dagChecker->EvaluatingLinkLibraries() ||
 
-           dagChecker->EvaluatingLinkerLauncher())) {
 
-       reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "$<LINK_LANG_AND_ID:lang,id> may only be used with binary targets "
 
-         "to specify link libraries, link directories, link options, and "
 
-         "link "
 
-         "depends.");
 
-       return std::string();
 
-     }
 
-     cmGlobalGenerator* gg = context->LG->GetGlobalGenerator();
 
-     std::string genName = gg->GetName();
 
-     if (genName.find("Makefiles") == std::string::npos &&
 
-         genName.find("Ninja") == std::string::npos &&
 
-         genName.find("Visual Studio") == std::string::npos &&
 
-         genName.find("Xcode") == std::string::npos &&
 
-         genName.find("Watcom WMake") == std::string::npos &&
 
-         genName.find("Green Hills MULTI") == std::string::npos) {
 
-       reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "$<LINK_LANG_AND_ID:lang,id> not supported for this generator.");
 
-       return std::string();
 
-     }
 
-     if (dagChecker->EvaluatingLinkLibraries()) {
 
-       context->HadHeadSensitiveCondition = true;
 
-       context->HadLinkLanguageSensitiveCondition = true;
 
-     }
 
-     std::string const& lang = context->Language;
 
-     if (lang == parameters.front()) {
 
-       std::vector<std::string> idParameter((parameters.cbegin() + 1),
 
-                                            parameters.cend());
 
-       return LinkerId::Evaluate(idParameter, context, content, lang);
 
-     }
 
-     return "0";
 
-   }
 
- } linkLanguageAndIdNode;
 
- static const struct LinkLibraryNode : public cmGeneratorExpressionNode
 
- {
 
-   LinkLibraryNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return OneOrMoreParameters; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* dagChecker) const override
 
-   {
 
-     using ForGenex = cmGeneratorExpressionDAGChecker::ForGenex;
 
-     if (!context->HeadTarget || !dagChecker ||
 
-         !dagChecker->EvaluatingLinkLibraries(nullptr,
 
-                                              ForGenex::LINK_LIBRARY)) {
 
-       reportError(context, content->GetOriginalExpression(),
 
-                   "$<LINK_LIBRARY:...> may only be used with binary targets "
 
-                   "to specify link libraries through 'LINK_LIBRARIES', "
 
-                   "'INTERFACE_LINK_LIBRARIES', and "
 
-                   "'INTERFACE_LINK_LIBRARIES_DIRECT' properties.");
 
-       return std::string();
 
-     }
 
-     cmList list{ parameters.begin(), parameters.end() };
 
-     if (list.empty()) {
 
-       reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "$<LINK_LIBRARY:...> expects a feature name as first argument.");
 
-       return std::string();
 
-     }
 
-     if (list.size() == 1) {
 
-       // no libraries specified, ignore this genex
 
-       return std::string();
 
-     }
 
-     static cmsys::RegularExpression featureNameValidator("^[A-Za-z0-9_]+$");
 
-     auto const& feature = list.front();
 
-     if (!featureNameValidator.find(feature)) {
 
-       reportError(context, content->GetOriginalExpression(),
 
-                   cmStrCat("The feature name '", feature,
 
-                            "' contains invalid characters."));
 
-       return std::string();
 
-     }
 
-     auto const LL_BEGIN = cmStrCat("<LINK_LIBRARY:", feature, '>');
 
-     auto const LL_END = cmStrCat("</LINK_LIBRARY:", feature, '>');
 
-     // filter out $<LINK_LIBRARY:..> tags with same feature
 
-     // and raise an error for any different feature
 
-     cm::erase_if(list, [&](std::string const& item) -> bool {
 
-       return item == LL_BEGIN || item == LL_END;
 
-     });
 
-     auto it =
 
-       std::find_if(list.cbegin() + 1, list.cend(),
 
-                    [&feature](std::string const& item) -> bool {
 
-                      return cmHasPrefix(item, "<LINK_LIBRARY:"_s) &&
 
-                        item.substr(14, item.find('>', 14) - 14) != feature;
 
-                    });
 
-     if (it != list.cend()) {
 
-       reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "$<LINK_LIBRARY:...> with different features cannot be nested.");
 
-       return std::string();
 
-     }
 
-     // $<LINK_GROUP:...> must not appear as part of $<LINK_LIBRARY:...>
 
-     it = std::find_if(list.cbegin() + 1, list.cend(),
 
-                       [](std::string const& item) -> bool {
 
-                         return cmHasPrefix(item, "<LINK_GROUP:"_s);
 
-                       });
 
-     if (it != list.cend()) {
 
-       reportError(context, content->GetOriginalExpression(),
 
-                   "$<LINK_GROUP:...> cannot be nested inside a "
 
-                   "$<LINK_LIBRARY:...> expression.");
 
-       return std::string();
 
-     }
 
-     list.front() = LL_BEGIN;
 
-     list.push_back(LL_END);
 
-     return list.to_string();
 
-   }
 
- } linkLibraryNode;
 
- static const struct LinkGroupNode : public cmGeneratorExpressionNode
 
- {
 
-   LinkGroupNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return OneOrMoreParameters; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* dagChecker) const override
 
-   {
 
-     using ForGenex = cmGeneratorExpressionDAGChecker::ForGenex;
 
-     if (!context->HeadTarget || !dagChecker ||
 
-         !dagChecker->EvaluatingLinkLibraries(nullptr, ForGenex::LINK_GROUP)) {
 
-       reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "$<LINK_GROUP:...> may only be used with binary targets "
 
-         "to specify group of link libraries through 'LINK_LIBRARIES', "
 
-         "'INTERFACE_LINK_LIBRARIES', and "
 
-         "'INTERFACE_LINK_LIBRARIES_DIRECT' properties.");
 
-       return std::string();
 
-     }
 
-     cmList list{ parameters.begin(), parameters.end() };
 
-     if (list.empty()) {
 
-       reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "$<LINK_GROUP:...> expects a feature name as first argument.");
 
-       return std::string();
 
-     }
 
-     // $<LINK_GROUP:..> cannot be nested
 
-     if (std::find_if(list.cbegin(), list.cend(),
 
-                      [](std::string const& item) -> bool {
 
-                        return cmHasPrefix(item, "<LINK_GROUP"_s);
 
-                      }) != list.cend()) {
 
-       reportError(context, content->GetOriginalExpression(),
 
-                   "$<LINK_GROUP:...> cannot be nested.");
 
-       return std::string();
 
-     }
 
-     if (list.size() == 1) {
 
-       // no libraries specified, ignore this genex
 
-       return std::string();
 
-     }
 
-     static cmsys::RegularExpression featureNameValidator("^[A-Za-z0-9_]+$");
 
-     auto const& feature = list.front();
 
-     if (!featureNameValidator.find(feature)) {
 
-       reportError(context, content->GetOriginalExpression(),
 
-                   cmStrCat("The feature name '", feature,
 
-                            "' contains invalid characters."));
 
-       return std::string();
 
-     }
 
-     auto const LG_BEGIN = cmStrCat(
 
-       "<LINK_GROUP:", feature, ':',
 
-       cmJoin(cmRange<decltype(list.cbegin())>(list.cbegin() + 1, list.cend()),
 
-              "|"_s),
 
-       '>');
 
-     auto const LG_END = cmStrCat("</LINK_GROUP:", feature, '>');
 
-     list.front() = LG_BEGIN;
 
-     list.push_back(LG_END);
 
-     return list.to_string();
 
-   }
 
- } linkGroupNode;
 
- static const struct HostLinkNode : public cmGeneratorExpressionNode
 
- {
 
-   HostLinkNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return ZeroOrMoreParameters; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* dagChecker) const override
 
-   {
 
-     if (!context->HeadTarget || !dagChecker ||
 
-         !dagChecker->EvaluatingLinkOptionsExpression()) {
 
-       reportError(context, content->GetOriginalExpression(),
 
-                   "$<HOST_LINK:...> may only be used with binary targets "
 
-                   "to specify link options.");
 
-       return std::string();
 
-     }
 
-     return context->HeadTarget->IsDeviceLink() ? std::string()
 
-                                                : cmList::to_string(parameters);
 
-   }
 
- } hostLinkNode;
 
- static const struct DeviceLinkNode : public cmGeneratorExpressionNode
 
- {
 
-   DeviceLinkNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return ZeroOrMoreParameters; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* dagChecker) const override
 
-   {
 
-     if (!context->HeadTarget || !dagChecker ||
 
-         !dagChecker->EvaluatingLinkOptionsExpression()) {
 
-       reportError(context, content->GetOriginalExpression(),
 
-                   "$<DEVICE_LINK:...> may only be used with binary targets "
 
-                   "to specify link options.");
 
-       return std::string();
 
-     }
 
-     if (context->HeadTarget->IsDeviceLink()) {
 
-       cmList list{ parameters.begin(), parameters.end() };
 
-       auto const DL_BEGIN = "<DEVICE_LINK>"_s;
 
-       auto const DL_END = "</DEVICE_LINK>"_s;
 
-       cm::erase_if(list, [&](std::string const& item) {
 
-         return item == DL_BEGIN || item == DL_END;
 
-       });
 
-       list.insert(list.begin(), static_cast<std::string>(DL_BEGIN));
 
-       list.push_back(static_cast<std::string>(DL_END));
 
-       return list.to_string();
 
-     }
 
-     return std::string();
 
-   }
 
- } deviceLinkNode;
 
- static std::string getLinkedTargetsContent(
 
-   cmGeneratorTarget const* target, std::string const& prop,
 
-   cmGeneratorExpressionContext* context,
 
-   cmGeneratorExpressionDAGChecker* dagChecker, cmGeneratorTarget::UseTo usage)
 
- {
 
-   std::string result;
 
-   if (cmLinkImplementationLibraries const* impl =
 
-         target->GetLinkImplementationLibraries(
 
-           context->Config, cmGeneratorTarget::UseTo::Compile)) {
 
-     for (cmLinkImplItem const& lib : impl->Libraries) {
 
-       if (lib.Target) {
 
-         // Pretend $<TARGET_PROPERTY:lib.Target,prop> appeared in our
 
-         // caller's property and hand-evaluate it as if it were compiled.
 
-         // Create a context as cmCompiledGeneratorExpression::Evaluate does.
 
-         cmGeneratorExpressionContext libContext(
 
-           target->GetLocalGenerator(), context->Config, context->Quiet, target,
 
-           target, context->EvaluateForBuildsystem, lib.Backtrace,
 
-           context->Language);
 
-         std::string libResult = lib.Target->EvaluateInterfaceProperty(
 
-           prop, &libContext, dagChecker, usage);
 
-         if (!libResult.empty()) {
 
-           if (result.empty()) {
 
-             result = std::move(libResult);
 
-           } else {
 
-             result.reserve(result.size() + 1 + libResult.size());
 
-             result += ";";
 
-             result += libResult;
 
-           }
 
-         }
 
-       }
 
-     }
 
-   }
 
-   return result;
 
- }
 
- static const struct TargetPropertyNode : public cmGeneratorExpressionNode
 
- {
 
-   TargetPropertyNode() {} // NOLINT(modernize-use-equals-default)
 
-   // This node handles errors on parameter count itself.
 
-   int NumExpectedParameters() const override { return OneOrMoreParameters; }
 
-   static char const* GetErrorText(std::string const& targetName,
 
-                                   std::string const& propertyName)
 
-   {
 
-     static cmsys::RegularExpression propertyNameValidator("^[A-Za-z0-9_]+$");
 
-     if (targetName.empty() && propertyName.empty()) {
 
-       return "$<TARGET_PROPERTY:tgt,prop> expression requires a non-empty "
 
-              "target name and property name.";
 
-     }
 
-     if (targetName.empty()) {
 
-       return "$<TARGET_PROPERTY:tgt,prop> expression requires a non-empty "
 
-              "target name.";
 
-     }
 
-     if (!cmGeneratorExpression::IsValidTargetName(targetName)) {
 
-       if (!propertyNameValidator.find(propertyName)) {
 
-         return "Target name and property name not supported.";
 
-       }
 
-       return "Target name not supported.";
 
-     }
 
-     return nullptr;
 
-   }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* dagCheckerParent) const override
 
-   {
 
-     static cmsys::RegularExpression propertyNameValidator("^[A-Za-z0-9_]+$");
 
-     cmGeneratorTarget const* target = nullptr;
 
-     std::string targetName;
 
-     std::string propertyName;
 
-     if (parameters.size() == 2) {
 
-       targetName = parameters[0];
 
-       propertyName = parameters[1];
 
-       if (char const* e = GetErrorText(targetName, propertyName)) {
 
-         reportError(context, content->GetOriginalExpression(), e);
 
-         return std::string();
 
-       }
 
-       if (propertyName == "ALIASED_TARGET"_s) {
 
-         if (context->LG->GetMakefile()->IsAlias(targetName)) {
 
-           if (cmGeneratorTarget* tgt =
 
-                 context->LG->FindGeneratorTargetToUse(targetName)) {
 
-             return tgt->GetName();
 
-           }
 
-         }
 
-         return std::string();
 
-       }
 
-       if (propertyName == "ALIAS_GLOBAL"_s) {
 
-         if (context->LG->GetMakefile()->IsAlias(targetName)) {
 
-           return context->LG->GetGlobalGenerator()->IsAlias(targetName)
 
-             ? "TRUE"
 
-             : "FALSE";
 
-         }
 
-         return std::string();
 
-       }
 
-       cmLocalGenerator const* lg = context->CurrentTarget
 
-         ? context->CurrentTarget->GetLocalGenerator()
 
-         : context->LG;
 
-       target = lg->FindGeneratorTargetToUse(targetName);
 
-       if (!target) {
 
-         std::ostringstream e;
 
-         e << "Target \"" << targetName << "\" not found.";
 
-         reportError(context, content->GetOriginalExpression(), e.str());
 
-         return std::string();
 
-       }
 
-       context->AllTargets.insert(target);
 
-     } else if (parameters.size() == 1) {
 
-       target = context->HeadTarget;
 
-       propertyName = parameters[0];
 
-       // Keep track of the properties seen while processing.
 
-       // The evaluation of the LINK_LIBRARIES generator expressions
 
-       // will check this to ensure that properties have one consistent
 
-       // value for all evaluations.
 
-       context->SeenTargetProperties.insert(propertyName);
 
-       context->HadHeadSensitiveCondition = true;
 
-       if (!target) {
 
-         reportError(
 
-           context, content->GetOriginalExpression(),
 
-           "$<TARGET_PROPERTY:prop>  may only be used with binary targets.  "
 
-           "It may not be used with add_custom_command or add_custom_target. "
 
-           " "
 
-           " "
 
-           "Specify the target to read a property from using the "
 
-           "$<TARGET_PROPERTY:tgt,prop> signature instead.");
 
-         return std::string();
 
-       }
 
-     } else {
 
-       reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "$<TARGET_PROPERTY:...> expression requires one or two parameters");
 
-       return std::string();
 
-     }
 
-     if (propertyName == "SOURCES") {
 
-       context->SourceSensitiveTargets.insert(target);
 
-     }
 
-     if (propertyName.empty()) {
 
-       reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "$<TARGET_PROPERTY:...> expression requires a non-empty property "
 
-         "name.");
 
-       return std::string();
 
-     }
 
-     if (!propertyNameValidator.find(propertyName)) {
 
-       ::reportError(context, content->GetOriginalExpression(),
 
-                     "Property name not supported.");
 
-       return std::string();
 
-     }
 
-     assert(target);
 
-     if (propertyName == "LINKER_LANGUAGE") {
 
-       if (target->LinkLanguagePropagatesToDependents() && dagCheckerParent &&
 
-           (dagCheckerParent->EvaluatingLinkLibraries() ||
 
-            dagCheckerParent->EvaluatingSources())) {
 
-         reportError(
 
-           context, content->GetOriginalExpression(),
 
-           "LINKER_LANGUAGE target property can not be used while evaluating "
 
-           "link libraries for a static library");
 
-         return std::string();
 
-       }
 
-       return target->GetLinkerLanguage(context->Config);
 
-     }
 
-     bool const evaluatingLinkLibraries =
 
-       dagCheckerParent && dagCheckerParent->EvaluatingLinkLibraries();
 
-     std::string interfacePropertyName;
 
-     bool isInterfaceProperty = false;
 
-     cmGeneratorTarget::UseTo usage = cmGeneratorTarget::UseTo::Compile;
 
-     if (cm::optional<cmGeneratorTarget::TransitiveProperty> transitiveProp =
 
-           target->IsTransitiveProperty(propertyName, context->LG,
 
-                                        context->Config,
 
-                                        evaluatingLinkLibraries)) {
 
-       interfacePropertyName = std::string(transitiveProp->InterfaceName);
 
-       isInterfaceProperty = transitiveProp->InterfaceName == propertyName;
 
-       usage = transitiveProp->Usage;
 
-     }
 
-     if (dagCheckerParent) {
 
-       // This $<TARGET_PROPERTY:...> node has been reached while evaluating
 
-       // another target property value.  Check that the outermost evaluation
 
-       // expects such nested evaluations.
 
-       if (dagCheckerParent->EvaluatingGenexExpression() ||
 
-           dagCheckerParent->EvaluatingPICExpression() ||
 
-           dagCheckerParent->EvaluatingLinkerLauncher()) {
 
-         // No check required.
 
-       } else if (evaluatingLinkLibraries) {
 
-         if (!interfacePropertyName.empty()) {
 
-           reportError(
 
-             context, content->GetOriginalExpression(),
 
-             "$<TARGET_PROPERTY:...> expression in link libraries "
 
-             "evaluation depends on target property which is transitive "
 
-             "over the link libraries, creating a recursion.");
 
-           return std::string();
 
-         }
 
-       } else {
 
-         assert(dagCheckerParent->EvaluatingTransitiveProperty());
 
-       }
 
-     }
 
-     if (isInterfaceProperty) {
 
-       return cmGeneratorExpression::StripEmptyListElements(
 
-         target->EvaluateInterfaceProperty(propertyName, context,
 
-                                           dagCheckerParent, usage));
 
-     }
 
-     cmGeneratorExpressionDAGChecker dagChecker(
 
-       context->Backtrace, target, propertyName, content, dagCheckerParent,
 
-       context->LG, context->Config);
 
-     switch (dagChecker.Check()) {
 
-       case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
 
-         dagChecker.ReportError(context, content->GetOriginalExpression());
 
-         return std::string();
 
-       case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE:
 
-         // No error. We just skip cyclic references.
 
-         return std::string();
 
-       case cmGeneratorExpressionDAGChecker::ALREADY_SEEN:
 
-         // We handle transitive properties above.  For non-transitive
 
-         // properties we accept repeats anyway.
 
-       case cmGeneratorExpressionDAGChecker::DAG:
 
-         break;
 
-     }
 
-     std::string result;
 
-     bool haveProp = false;
 
-     if (cmValue p = target->GetProperty(propertyName)) {
 
-       result = *p;
 
-       haveProp = true;
 
-     } else if (evaluatingLinkLibraries) {
 
-       return std::string();
 
-     }
 
-     // Properties named by COMPATIBLE_INTERFACE_ properties combine over
 
-     // the transitive link closure as a single order-independent value.
 
-     // Imported targets do not themselves have a defined value for these
 
-     // properties, but they can contribute to the value of a non-imported
 
-     // dependent.
 
-     //
 
-     // For COMPATIBLE_INTERFACE_{BOOL,STRING}:
 
-     // * If set on this target, use the value directly.  It is checked
 
-     //   elsewhere for consistency over the transitive link closure.
 
-     // * If not set on this target, compute the value from the closure.
 
-     //
 
-     // For COMPATIBLE_INTERFACE_NUMBER_{MAX,MIN} we always compute the value
 
-     // from this target and the transitive link closure to get the max or min.
 
-     if (!haveProp && !target->IsImported()) {
 
-       if (target->IsLinkInterfaceDependentBoolProperty(propertyName,
 
-                                                        context->Config)) {
 
-         context->HadContextSensitiveCondition = true;
 
-         return target->GetLinkInterfaceDependentBoolProperty(propertyName,
 
-                                                              context->Config)
 
-           ? "1"
 
-           : "0";
 
-       }
 
-       if (target->IsLinkInterfaceDependentStringProperty(propertyName,
 
-                                                          context->Config)) {
 
-         context->HadContextSensitiveCondition = true;
 
-         char const* propContent =
 
-           target->GetLinkInterfaceDependentStringProperty(propertyName,
 
-                                                           context->Config);
 
-         return propContent ? propContent : "";
 
-       }
 
-     }
 
-     if (!evaluatingLinkLibraries && !target->IsImported()) {
 
-       if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName,
 
-                                                             context->Config)) {
 
-         context->HadContextSensitiveCondition = true;
 
-         char const* propContent =
 
-           target->GetLinkInterfaceDependentNumberMinProperty(propertyName,
 
-                                                              context->Config);
 
-         return propContent ? propContent : "";
 
-       }
 
-       if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName,
 
-                                                             context->Config)) {
 
-         context->HadContextSensitiveCondition = true;
 
-         char const* propContent =
 
-           target->GetLinkInterfaceDependentNumberMaxProperty(propertyName,
 
-                                                              context->Config);
 
-         return propContent ? propContent : "";
 
-       }
 
-     }
 
-     // Some properties, such as usage requirements, combine over the
 
-     // transitive link closure as an ordered list.
 
-     if (!interfacePropertyName.empty()) {
 
-       result = cmGeneratorExpression::StripEmptyListElements(
 
-         this->EvaluateDependentExpression(result, context->LG, context, target,
 
-                                           &dagChecker, target));
 
-       std::string linkedTargetsContent = getLinkedTargetsContent(
 
-         target, interfacePropertyName, context, &dagChecker, usage);
 
-       if (!linkedTargetsContent.empty()) {
 
-         result += (result.empty() ? "" : ";") + linkedTargetsContent;
 
-       }
 
-     }
 
-     return result;
 
-   }
 
- } targetPropertyNode;
 
- static const struct TargetNameNode : public cmGeneratorExpressionNode
 
- {
 
-   TargetNameNode() {} // NOLINT(modernize-use-equals-default)
 
-   bool GeneratesContent() const override { return true; }
 
-   bool AcceptsArbitraryContentParameter() const override { return true; }
 
-   bool RequiresLiteralInput() const override { return true; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* /*context*/,
 
-     GeneratorExpressionContent const* /*content*/,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     return parameters.front();
 
-   }
 
-   int NumExpectedParameters() const override { return 1; }
 
- } targetNameNode;
 
- static const struct TargetObjectsNode : public cmGeneratorExpressionNode
 
- {
 
-   TargetObjectsNode() {} // NOLINT(modernize-use-equals-default)
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     std::string const& tgtName = parameters.front();
 
-     cmGeneratorTarget* gt = context->LG->FindGeneratorTargetToUse(tgtName);
 
-     if (!gt) {
 
-       std::ostringstream e;
 
-       e << "Objects of target \"" << tgtName
 
-         << "\" referenced but no such target exists.";
 
-       reportError(context, content->GetOriginalExpression(), e.str());
 
-       return std::string();
 
-     }
 
-     cmStateEnums::TargetType type = gt->GetType();
 
-     if (type != cmStateEnums::EXECUTABLE &&
 
-         type != cmStateEnums::STATIC_LIBRARY &&
 
-         type != cmStateEnums::SHARED_LIBRARY &&
 
-         type != cmStateEnums::MODULE_LIBRARY &&
 
-         type != cmStateEnums::OBJECT_LIBRARY) {
 
-       std::ostringstream e;
 
-       e << "Objects of target \"" << tgtName
 
-         << "\" referenced but is not one of the allowed target types "
 
-         << "(EXECUTABLE, STATIC, SHARED, MODULE, OBJECT).";
 
-       reportError(context, content->GetOriginalExpression(), e.str());
 
-       return std::string();
 
-     }
 
-     cmGlobalGenerator* gg = context->LG->GetGlobalGenerator();
 
-     {
 
-       std::string reason;
 
-       if (!context->EvaluateForBuildsystem &&
 
-           !gt->Target->HasKnownObjectFileLocation(&reason)) {
 
-         std::ostringstream e;
 
-         e << "The evaluation of the TARGET_OBJECTS generator expression "
 
-              "is only suitable for consumption by CMake (limited"
 
-           << reason
 
-           << ").  "
 
-              "It is not suitable for writing out elsewhere.";
 
-         reportError(context, content->GetOriginalExpression(), e.str());
 
-         return std::string();
 
-       }
 
-     }
 
-     cmList objects;
 
-     if (gt->IsImported()) {
 
-       cmValue loc = nullptr;
 
-       cmValue imp = nullptr;
 
-       std::string suffix;
 
-       if (gt->Target->GetMappedConfig(context->Config, loc, imp, suffix)) {
 
-         objects.assign(*loc);
 
-       }
 
-       context->HadContextSensitiveCondition = true;
 
-     } else {
 
-       gt->GetTargetObjectNames(context->Config, objects);
 
-       std::string obj_dir;
 
-       if (context->EvaluateForBuildsystem && !gg->SupportsCrossConfigs()) {
 
-         // Use object file directory with buildsystem placeholder.
 
-         obj_dir = gt->ObjectDirectory;
 
-         context->HadContextSensitiveCondition =
 
-           gt->HasContextDependentSources();
 
-       } else {
 
-         // Use object file directory with per-config location.
 
-         obj_dir = gt->GetObjectDirectory(context->Config);
 
-         context->HadContextSensitiveCondition = true;
 
-       }
 
-       for (auto& o : objects) {
 
-         o = cmStrCat(obj_dir, o);
 
-       }
 
-     }
 
-     // Create the cmSourceFile instances in the referencing directory.
 
-     cmMakefile* mf = context->LG->GetMakefile();
 
-     for (std::string const& o : objects) {
 
-       mf->AddTargetObject(tgtName, o);
 
-     }
 
-     return objects.to_string();
 
-   }
 
- } targetObjectsNode;
 
- struct TargetRuntimeDllsBaseNode : public cmGeneratorExpressionNode
 
- {
 
-   std::vector<std::string> CollectDlls(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content) const
 
-   {
 
-     std::string const& tgtName = parameters.front();
 
-     cmGeneratorTarget* gt = context->LG->FindGeneratorTargetToUse(tgtName);
 
-     if (!gt) {
 
-       std::ostringstream e;
 
-       e << "Objects of target \"" << tgtName
 
-         << "\" referenced but no such target exists.";
 
-       reportError(context, content->GetOriginalExpression(), e.str());
 
-       return std::vector<std::string>();
 
-     }
 
-     cmStateEnums::TargetType type = gt->GetType();
 
-     if (type != cmStateEnums::EXECUTABLE &&
 
-         type != cmStateEnums::SHARED_LIBRARY &&
 
-         type != cmStateEnums::MODULE_LIBRARY) {
 
-       std::ostringstream e;
 
-       e << "Objects of target \"" << tgtName
 
-         << "\" referenced but is not one of the allowed target types "
 
-         << "(EXECUTABLE, SHARED, MODULE).";
 
-       reportError(context, content->GetOriginalExpression(), e.str());
 
-       return std::vector<std::string>();
 
-     }
 
-     if (auto* cli = gt->GetLinkInformation(context->Config)) {
 
-       std::vector<std::string> dllPaths;
 
-       auto const& dlls = cli->GetRuntimeDLLs();
 
-       for (auto const& dll : dlls) {
 
-         if (auto loc = dll->MaybeGetLocation(context->Config)) {
 
-           dllPaths.emplace_back(*loc);
 
-         }
 
-       }
 
-       return dllPaths;
 
-     }
 
-     return std::vector<std::string>();
 
-   }
 
- };
 
- static const struct TargetRuntimeDllsNode : public TargetRuntimeDllsBaseNode
 
- {
 
-   TargetRuntimeDllsNode() {} // NOLINT(modernize-use-equals-default)
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     std::vector<std::string> dlls = CollectDlls(parameters, context, content);
 
-     return cmList::to_string(dlls);
 
-   }
 
- } targetRuntimeDllsNode;
 
- static const struct TargetRuntimeDllDirsNode : public TargetRuntimeDllsBaseNode
 
- {
 
-   TargetRuntimeDllDirsNode() {} // NOLINT(modernize-use-equals-default)
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     std::vector<std::string> dlls = CollectDlls(parameters, context, content);
 
-     std::vector<std::string> dllDirs;
 
-     for (std::string const& dll : dlls) {
 
-       std::string directory = cmSystemTools::GetFilenamePath(dll);
 
-       if (std::find(dllDirs.begin(), dllDirs.end(), directory) ==
 
-           dllDirs.end()) {
 
-         dllDirs.push_back(directory);
 
-       }
 
-     }
 
-     return cmList::to_string(dllDirs);
 
-   }
 
- } targetRuntimeDllDirsNode;
 
- static const struct CompileFeaturesNode : public cmGeneratorExpressionNode
 
- {
 
-   CompileFeaturesNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return OneOrMoreParameters; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* dagChecker) const override
 
-   {
 
-     cmGeneratorTarget const* target = context->HeadTarget;
 
-     if (!target) {
 
-       reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "$<COMPILE_FEATURE> may only be used with binary targets.  It may "
 
-         "not be used with add_custom_command or add_custom_target.");
 
-       return std::string();
 
-     }
 
-     context->HadHeadSensitiveCondition = true;
 
-     using LangMap = std::map<std::string, cmList>;
 
-     static LangMap availableFeatures;
 
-     LangMap testedFeatures;
 
-     cmStandardLevelResolver standardResolver(context->LG->GetMakefile());
 
-     for (std::string const& p : parameters) {
 
-       std::string error;
 
-       std::string lang;
 
-       if (!standardResolver.CompileFeatureKnown(
 
-             context->HeadTarget->Target->GetName(), p, lang, &error)) {
 
-         reportError(context, content->GetOriginalExpression(), error);
 
-         return std::string();
 
-       }
 
-       testedFeatures[lang].push_back(p);
 
-       if (availableFeatures.find(lang) == availableFeatures.end()) {
 
-         cmValue featuresKnown =
 
-           standardResolver.CompileFeaturesAvailable(lang, &error);
 
-         if (!featuresKnown) {
 
-           reportError(context, content->GetOriginalExpression(), error);
 
-           return std::string();
 
-         }
 
-         availableFeatures[lang].assign(featuresKnown);
 
-       }
 
-     }
 
-     bool evalLL = dagChecker && dagChecker->EvaluatingLinkLibraries();
 
-     for (auto const& lit : testedFeatures) {
 
-       std::vector<std::string> const& langAvailable =
 
-         availableFeatures[lit.first];
 
-       cmValue standardDefault = context->LG->GetMakefile()->GetDefinition(
 
-         "CMAKE_" + lit.first + "_STANDARD_DEFAULT");
 
-       for (std::string const& it : lit.second) {
 
-         if (!cm::contains(langAvailable, it)) {
 
-           return "0";
 
-         }
 
-         if (standardDefault && standardDefault->empty()) {
 
-           // This compiler has no notion of language standard levels.
 
-           // All features known for the language are always available.
 
-           continue;
 
-         }
 
-         if (!standardResolver.HaveStandardAvailable(target, lit.first,
 
-                                                     context->Config, it)) {
 
-           if (evalLL) {
 
-             cmValue l =
 
-               target->GetLanguageStandard(lit.first, context->Config);
 
-             if (!l) {
 
-               l = standardDefault;
 
-             }
 
-             assert(l);
 
-             context->MaxLanguageStandard[target][lit.first] = *l;
 
-           } else {
 
-             return "0";
 
-           }
 
-         }
 
-       }
 
-     }
 
-     return "1";
 
-   }
 
- } compileFeaturesNode;
 
- static char const* targetPolicyWhitelist[] = {
 
-   nullptr
 
- #define TARGET_POLICY_STRING(POLICY) , #POLICY
 
-   CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_STRING)
 
- #undef TARGET_POLICY_STRING
 
- };
 
- static cmPolicies::PolicyStatus statusForTarget(cmGeneratorTarget const* tgt,
 
-                                                 char const* policy)
 
- {
 
- #define RETURN_POLICY(POLICY)                                                 \
 
-   if (strcmp(policy, #POLICY) == 0) {                                         \
 
-     return tgt->GetPolicyStatus##POLICY();                                    \
 
-   }
 
-   CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY)
 
- #undef RETURN_POLICY
 
-   assert(false && "Unreachable code. Not a valid policy");
 
-   return cmPolicies::WARN;
 
- }
 
- static cmPolicies::PolicyID policyForString(char const* policy_id)
 
- {
 
- #define RETURN_POLICY_ID(POLICY_ID)                                           \
 
-   if (strcmp(policy_id, #POLICY_ID) == 0) {                                   \
 
-     return cmPolicies::POLICY_ID;                                             \
 
-   }
 
-   CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY_ID)
 
- #undef RETURN_POLICY_ID
 
-   assert(false && "Unreachable code. Not a valid policy");
 
-   return cmPolicies::CMPCOUNT;
 
- }
 
- static const struct TargetPolicyNode : public cmGeneratorExpressionNode
 
- {
 
-   TargetPolicyNode() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return 1; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     if (!context->HeadTarget) {
 
-       reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "$<TARGET_POLICY:prop> may only be used with binary targets.  It "
 
-         "may not be used with add_custom_command or add_custom_target.");
 
-       return std::string();
 
-     }
 
-     context->HadContextSensitiveCondition = true;
 
-     context->HadHeadSensitiveCondition = true;
 
-     for (size_t i = 1; i < cm::size(targetPolicyWhitelist); ++i) {
 
-       char const* policy = targetPolicyWhitelist[i];
 
-       if (parameters.front() == policy) {
 
-         cmLocalGenerator* lg = context->HeadTarget->GetLocalGenerator();
 
-         switch (statusForTarget(context->HeadTarget, policy)) {
 
-           case cmPolicies::WARN:
 
-             lg->IssueMessage(
 
-               MessageType::AUTHOR_WARNING,
 
-               cmPolicies::GetPolicyWarning(policyForString(policy)));
 
-             CM_FALLTHROUGH;
 
-           case cmPolicies::OLD:
 
-             return "0";
 
-           case cmPolicies::NEW:
 
-             return "1";
 
-         }
 
-       }
 
-     }
 
-     reportError(
 
-       context, content->GetOriginalExpression(),
 
-       "$<TARGET_POLICY:prop> may only be used with a limited number of "
 
-       "policies.  Currently it may be used with the following policies:\n"
 
- #define STRINGIFY_HELPER(X) #X
 
- #define STRINGIFY(X) STRINGIFY_HELPER(X)
 
- #define TARGET_POLICY_LIST_ITEM(POLICY) " * " STRINGIFY(POLICY) "\n"
 
-       CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_LIST_ITEM)
 
- #undef TARGET_POLICY_LIST_ITEM
 
-     );
 
-     return std::string();
 
-   }
 
- } targetPolicyNode;
 
- static const struct InstallPrefixNode : public cmGeneratorExpressionNode
 
- {
 
-   InstallPrefixNode() {} // NOLINT(modernize-use-equals-default)
 
-   bool GeneratesContent() const override { return true; }
 
-   int NumExpectedParameters() const override { return 0; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& /*parameters*/,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     reportError(context, content->GetOriginalExpression(),
 
-                 "INSTALL_PREFIX is a marker for install(EXPORT) only.  It "
 
-                 "should never be evaluated.");
 
-     return std::string();
 
-   }
 
- } installPrefixNode;
 
- class ArtifactDirTag;
 
- class ArtifactLinkerTag;
 
- class ArtifactLinkerLibraryTag;
 
- class ArtifactLinkerImportTag;
 
- class ArtifactNameTag;
 
- class ArtifactImportTag;
 
- class ArtifactPathTag;
 
- class ArtifactPdbTag;
 
- class ArtifactSonameTag;
 
- class ArtifactSonameImportTag;
 
- class ArtifactBundleDirTag;
 
- class ArtifactBundleDirNameTag;
 
- class ArtifactBundleContentDirTag;
 
- template <typename ArtifactT, typename ComponentT>
 
- struct TargetFilesystemArtifactDependency
 
- {
 
-   static void AddDependency(cmGeneratorTarget* target,
 
-                             cmGeneratorExpressionContext* context)
 
-   {
 
-     context->DependTargets.insert(target);
 
-     context->AllTargets.insert(target);
 
-   }
 
- };
 
- struct TargetFilesystemArtifactDependencyCMP0112
 
- {
 
-   static void AddDependency(cmGeneratorTarget* target,
 
-                             cmGeneratorExpressionContext* context)
 
-   {
 
-     context->AllTargets.insert(target);
 
-     cmLocalGenerator* lg = context->LG;
 
-     switch (target->GetPolicyStatusCMP0112()) {
 
-       case cmPolicies::WARN:
 
-         if (lg->GetMakefile()->PolicyOptionalWarningEnabled(
 
-               "CMAKE_POLICY_WARNING_CMP0112")) {
 
-           std::string err =
 
-             cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0112),
 
-                      "\nDependency being added to target:\n  \"",
 
-                      target->GetName(), "\"\n");
 
-           lg->GetCMakeInstance()->IssueMessage(MessageType ::AUTHOR_WARNING,
 
-                                                err, context->Backtrace);
 
-         }
 
-         CM_FALLTHROUGH;
 
-       case cmPolicies::OLD:
 
-         context->DependTargets.insert(target);
 
-         break;
 
-       case cmPolicies::NEW:
 
-         break;
 
-     }
 
-   }
 
- };
 
- template <typename ArtifactT>
 
- struct TargetFilesystemArtifactDependency<ArtifactT, ArtifactNameTag>
 
-   : TargetFilesystemArtifactDependencyCMP0112
 
- {
 
- };
 
- template <typename ArtifactT>
 
- struct TargetFilesystemArtifactDependency<ArtifactT, ArtifactDirTag>
 
-   : TargetFilesystemArtifactDependencyCMP0112
 
- {
 
- };
 
- template <>
 
- struct TargetFilesystemArtifactDependency<ArtifactBundleDirTag,
 
-                                           ArtifactPathTag>
 
-   : TargetFilesystemArtifactDependencyCMP0112
 
- {
 
- };
 
- template <>
 
- struct TargetFilesystemArtifactDependency<ArtifactBundleDirNameTag,
 
-                                           ArtifactPathTag>
 
-   : TargetFilesystemArtifactDependencyCMP0112
 
- {
 
- };
 
- template <>
 
- struct TargetFilesystemArtifactDependency<ArtifactBundleContentDirTag,
 
-                                           ArtifactPathTag>
 
-   : TargetFilesystemArtifactDependencyCMP0112
 
- {
 
- };
 
- template <typename ArtifactT>
 
- struct TargetFilesystemArtifactResultCreator
 
- {
 
-   static std::string Create(cmGeneratorTarget* target,
 
-                             cmGeneratorExpressionContext* context,
 
-                             GeneratorExpressionContent const* content);
 
- };
 
- template <>
 
- struct TargetFilesystemArtifactResultCreator<ArtifactSonameTag>
 
- {
 
-   static std::string Create(cmGeneratorTarget* target,
 
-                             cmGeneratorExpressionContext* context,
 
-                             GeneratorExpressionContent const* content)
 
-   {
 
-     // The target soname file (.so.1).
 
-     if (target->IsDLLPlatform()) {
 
-       ::reportError(context, content->GetOriginalExpression(),
 
-                     "TARGET_SONAME_FILE is not allowed "
 
-                     "for DLL target platforms.");
 
-       return std::string();
 
-     }
 
-     if (target->GetType() != cmStateEnums::SHARED_LIBRARY) {
 
-       ::reportError(context, content->GetOriginalExpression(),
 
-                     "TARGET_SONAME_FILE is allowed only for "
 
-                     "SHARED libraries.");
 
-       return std::string();
 
-     }
 
-     if (target->IsArchivedAIXSharedLibrary()) {
 
-       ::reportError(context, content->GetOriginalExpression(),
 
-                     "TARGET_SONAME_FILE is not allowed for "
 
-                     "AIX_SHARED_LIBRARY_ARCHIVE libraries.");
 
-       return std::string();
 
-     }
 
-     std::string result = cmStrCat(target->GetDirectory(context->Config), '/',
 
-                                   target->GetSOName(context->Config));
 
-     return result;
 
-   }
 
- };
 
- template <>
 
- struct TargetFilesystemArtifactResultCreator<ArtifactSonameImportTag>
 
- {
 
-   static std::string Create(cmGeneratorTarget* target,
 
-                             cmGeneratorExpressionContext* context,
 
-                             GeneratorExpressionContent const* content)
 
-   {
 
-     // The target soname file (.so.1).
 
-     if (target->IsDLLPlatform()) {
 
-       ::reportError(context, content->GetOriginalExpression(),
 
-                     "TARGET_SONAME_IMPORT_FILE is not allowed "
 
-                     "for DLL target platforms.");
 
-       return std::string();
 
-     }
 
-     if (target->GetType() != cmStateEnums::SHARED_LIBRARY) {
 
-       ::reportError(context, content->GetOriginalExpression(),
 
-                     "TARGET_SONAME_IMPORT_FILE is allowed only for "
 
-                     "SHARED libraries.");
 
-       return std::string();
 
-     }
 
-     if (target->IsArchivedAIXSharedLibrary()) {
 
-       ::reportError(context, content->GetOriginalExpression(),
 
-                     "TARGET_SONAME_IMPORT_FILE is not allowed for "
 
-                     "AIX_SHARED_LIBRARY_ARCHIVE libraries.");
 
-       return std::string();
 
-     }
 
-     if (target->HasImportLibrary(context->Config)) {
 
-       return cmStrCat(target->GetDirectory(
 
-                         context->Config, cmStateEnums::ImportLibraryArtifact),
 
-                       '/',
 
-                       target->GetSOName(context->Config,
 
-                                         cmStateEnums::ImportLibraryArtifact));
 
-     }
 
-     return std::string{};
 
-   }
 
- };
 
- template <>
 
- struct TargetFilesystemArtifactResultCreator<ArtifactPdbTag>
 
- {
 
-   static std::string Create(cmGeneratorTarget* target,
 
-                             cmGeneratorExpressionContext* context,
 
-                             GeneratorExpressionContent const* content)
 
-   {
 
-     if (target->IsImported()) {
 
-       ::reportError(context, content->GetOriginalExpression(),
 
-                     "TARGET_PDB_FILE not allowed for IMPORTED targets.");
 
-       return std::string();
 
-     }
 
-     std::string language = target->GetLinkerLanguage(context->Config);
 
-     std::string pdbSupportVar = "CMAKE_" + language + "_LINKER_SUPPORTS_PDB";
 
-     if (!context->LG->GetMakefile()->IsOn(pdbSupportVar)) {
 
-       ::reportError(context, content->GetOriginalExpression(),
 
-                     "TARGET_PDB_FILE is not supported by the target linker.");
 
-       return std::string();
 
-     }
 
-     cmStateEnums::TargetType targetType = target->GetType();
 
-     if (targetType != cmStateEnums::SHARED_LIBRARY &&
 
-         targetType != cmStateEnums::MODULE_LIBRARY &&
 
-         targetType != cmStateEnums::EXECUTABLE) {
 
-       ::reportError(context, content->GetOriginalExpression(),
 
-                     "TARGET_PDB_FILE is allowed only for "
 
-                     "targets with linker created artifacts.");
 
-       return std::string();
 
-     }
 
-     std::string result = cmStrCat(target->GetPDBDirectory(context->Config),
 
-                                   '/', target->GetPDBName(context->Config));
 
-     return result;
 
-   }
 
- };
 
- template <>
 
- struct TargetFilesystemArtifactResultCreator<ArtifactLinkerTag>
 
- {
 
-   static std::string Create(cmGeneratorTarget* target,
 
-                             cmGeneratorExpressionContext* context,
 
-                             GeneratorExpressionContent const* content)
 
-   {
 
-     // The file used to link to the target (.so, .lib, .a) or import file
 
-     // (.lib,  .tbd).
 
-     if (!target->IsLinkable()) {
 
-       ::reportError(context, content->GetOriginalExpression(),
 
-                     "TARGET_LINKER_FILE is allowed only for libraries and "
 
-                     "executables with ENABLE_EXPORTS.");
 
-       return std::string();
 
-     }
 
-     cmStateEnums::ArtifactType artifact =
 
-       target->HasImportLibrary(context->Config)
 
-       ? cmStateEnums::ImportLibraryArtifact
 
-       : cmStateEnums::RuntimeBinaryArtifact;
 
-     return target->GetFullPath(context->Config, artifact);
 
-   }
 
- };
 
- template <>
 
- struct TargetFilesystemArtifactResultCreator<ArtifactLinkerLibraryTag>
 
- {
 
-   static std::string Create(cmGeneratorTarget* target,
 
-                             cmGeneratorExpressionContext* context,
 
-                             GeneratorExpressionContent const* content)
 
-   {
 
-     // The file used to link to the target (.dylib, .so, .a).
 
-     if (!target->IsLinkable() ||
 
-         target->GetType() == cmStateEnums::EXECUTABLE) {
 
-       ::reportError(context, content->GetOriginalExpression(),
 
-                     "TARGET_LINKER_LIBRARY_FILE is allowed only for libraries "
 
-                     "with ENABLE_EXPORTS.");
 
-       return std::string();
 
-     }
 
-     if (!target->IsDLLPlatform() ||
 
-         target->GetType() == cmStateEnums::STATIC_LIBRARY) {
 
-       return target->GetFullPath(context->Config,
 
-                                  cmStateEnums::RuntimeBinaryArtifact);
 
-     }
 
-     return std::string{};
 
-   }
 
- };
 
- template <>
 
- struct TargetFilesystemArtifactResultCreator<ArtifactLinkerImportTag>
 
- {
 
-   static std::string Create(cmGeneratorTarget* target,
 
-                             cmGeneratorExpressionContext* context,
 
-                             GeneratorExpressionContent const* content)
 
-   {
 
-     // The file used to link to the target (.lib, .tbd).
 
-     if (!target->IsLinkable()) {
 
-       ::reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "TARGET_LINKER_IMPORT_FILE is allowed only for libraries and "
 
-         "executables with ENABLE_EXPORTS.");
 
-       return std::string();
 
-     }
 
-     if (target->HasImportLibrary(context->Config)) {
 
-       return target->GetFullPath(context->Config,
 
-                                  cmStateEnums::ImportLibraryArtifact);
 
-     }
 
-     return std::string{};
 
-   }
 
- };
 
- template <>
 
- struct TargetFilesystemArtifactResultCreator<ArtifactBundleDirTag>
 
- {
 
-   static std::string Create(cmGeneratorTarget* target,
 
-                             cmGeneratorExpressionContext* context,
 
-                             GeneratorExpressionContent const* content)
 
-   {
 
-     if (target->IsImported()) {
 
-       ::reportError(context, content->GetOriginalExpression(),
 
-                     "TARGET_BUNDLE_DIR not allowed for IMPORTED targets.");
 
-       return std::string();
 
-     }
 
-     if (!target->IsBundleOnApple()) {
 
-       ::reportError(context, content->GetOriginalExpression(),
 
-                     "TARGET_BUNDLE_DIR is allowed only for Bundle targets.");
 
-       return std::string();
 
-     }
 
-     std::string outpath = target->GetDirectory(context->Config) + '/';
 
-     return target->BuildBundleDirectory(outpath, context->Config,
 
-                                         cmGeneratorTarget::BundleDirLevel);
 
-   }
 
- };
 
- template <>
 
- struct TargetFilesystemArtifactResultCreator<ArtifactBundleDirNameTag>
 
- {
 
-   static std::string Create(cmGeneratorTarget* target,
 
-                             cmGeneratorExpressionContext* context,
 
-                             GeneratorExpressionContent const* content)
 
-   {
 
-     if (target->IsImported()) {
 
-       ::reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "TARGET_BUNDLE_DIR_NAME not allowed for IMPORTED targets.");
 
-       return std::string();
 
-     }
 
-     if (!target->IsBundleOnApple()) {
 
-       ::reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "TARGET_BUNDLE_DIR_NAME is allowed only for Bundle targets.");
 
-       return std::string();
 
-     }
 
-     auto level = cmGeneratorTarget::BundleDirLevel;
 
-     auto config = context->Config;
 
-     if (target->IsAppBundleOnApple()) {
 
-       return target->GetAppBundleDirectory(config, level);
 
-     }
 
-     if (target->IsFrameworkOnApple()) {
 
-       return target->GetFrameworkDirectory(config, level);
 
-     }
 
-     if (target->IsCFBundleOnApple()) {
 
-       return target->GetCFBundleDirectory(config, level);
 
-     }
 
-     return std::string();
 
-   }
 
- };
 
- template <>
 
- struct TargetFilesystemArtifactResultCreator<ArtifactBundleContentDirTag>
 
- {
 
-   static std::string Create(cmGeneratorTarget* target,
 
-                             cmGeneratorExpressionContext* context,
 
-                             GeneratorExpressionContent const* content)
 
-   {
 
-     if (target->IsImported()) {
 
-       ::reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "TARGET_BUNDLE_CONTENT_DIR not allowed for IMPORTED targets.");
 
-       return std::string();
 
-     }
 
-     if (!target->IsBundleOnApple()) {
 
-       ::reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "TARGET_BUNDLE_CONTENT_DIR is allowed only for Bundle targets.");
 
-       return std::string();
 
-     }
 
-     std::string outpath = target->GetDirectory(context->Config) + '/';
 
-     return target->BuildBundleDirectory(outpath, context->Config,
 
-                                         cmGeneratorTarget::ContentLevel);
 
-   }
 
- };
 
- template <>
 
- struct TargetFilesystemArtifactResultCreator<ArtifactNameTag>
 
- {
 
-   static std::string Create(cmGeneratorTarget* target,
 
-                             cmGeneratorExpressionContext* context,
 
-                             GeneratorExpressionContent const* /*unused*/)
 
-   {
 
-     return target->GetFullPath(context->Config,
 
-                                cmStateEnums::RuntimeBinaryArtifact, true);
 
-   }
 
- };
 
- template <>
 
- struct TargetFilesystemArtifactResultCreator<ArtifactImportTag>
 
- {
 
-   static std::string Create(cmGeneratorTarget* target,
 
-                             cmGeneratorExpressionContext* context,
 
-                             GeneratorExpressionContent const* /*unused*/)
 
-   {
 
-     if (target->HasImportLibrary(context->Config)) {
 
-       return target->GetFullPath(context->Config,
 
-                                  cmStateEnums::ImportLibraryArtifact, true);
 
-     }
 
-     return std::string{};
 
-   }
 
- };
 
- template <typename ArtifactT>
 
- struct TargetFilesystemArtifactResultGetter
 
- {
 
-   static std::string Get(std::string const& result);
 
- };
 
- template <>
 
- struct TargetFilesystemArtifactResultGetter<ArtifactNameTag>
 
- {
 
-   static std::string Get(std::string const& result)
 
-   {
 
-     return cmSystemTools::GetFilenameName(result);
 
-   }
 
- };
 
- template <>
 
- struct TargetFilesystemArtifactResultGetter<ArtifactDirTag>
 
- {
 
-   static std::string Get(std::string const& result)
 
-   {
 
-     return cmSystemTools::GetFilenamePath(result);
 
-   }
 
- };
 
- template <>
 
- struct TargetFilesystemArtifactResultGetter<ArtifactPathTag>
 
- {
 
-   static std::string Get(std::string const& result) { return result; }
 
- };
 
- struct TargetArtifactBase : public cmGeneratorExpressionNode
 
- {
 
-   TargetArtifactBase() {} // NOLINT(modernize-use-equals-default)
 
- protected:
 
-   cmGeneratorTarget* GetTarget(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* dagChecker) const
 
-   {
 
-     // Lookup the referenced target.
 
-     std::string const& name = parameters.front();
 
-     if (!cmGeneratorExpression::IsValidTargetName(name)) {
 
-       ::reportError(context, content->GetOriginalExpression(),
 
-                     "Expression syntax not recognized.");
 
-       return nullptr;
 
-     }
 
-     cmGeneratorTarget* target = context->LG->FindGeneratorTargetToUse(name);
 
-     if (!target) {
 
-       ::reportError(context, content->GetOriginalExpression(),
 
-                     "No target \"" + name + "\"");
 
-       return nullptr;
 
-     }
 
-     if (target->GetType() >= cmStateEnums::OBJECT_LIBRARY &&
 
-         target->GetType() != cmStateEnums::UNKNOWN_LIBRARY) {
 
-       ::reportError(context, content->GetOriginalExpression(),
 
-                     "Target \"" + name +
 
-                       "\" is not an executable or library.");
 
-       return nullptr;
 
-     }
 
-     if (dagChecker &&
 
-         (dagChecker->EvaluatingLinkLibraries(target) ||
 
-          (dagChecker->EvaluatingSources() &&
 
-           target == dagChecker->TopTarget()))) {
 
-       ::reportError(context, content->GetOriginalExpression(),
 
-                     "Expressions which require the linker language may not "
 
-                     "be used while evaluating link libraries");
 
-       return nullptr;
 
-     }
 
-     return target;
 
-   }
 
- };
 
- template <typename ArtifactT, typename ComponentT>
 
- struct TargetFilesystemArtifact : public TargetArtifactBase
 
- {
 
-   TargetFilesystemArtifact() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return 1; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* dagChecker) const override
 
-   {
 
-     cmGeneratorTarget* target =
 
-       this->GetTarget(parameters, context, content, dagChecker);
 
-     if (!target) {
 
-       return std::string();
 
-     }
 
-     // Not a dependent target if we are querying for ArtifactDirTag,
 
-     // ArtifactNameTag, ArtifactBundleDirTag, ArtifactBundleDirNameTag,
 
-     // and ArtifactBundleContentDirTag
 
-     TargetFilesystemArtifactDependency<ArtifactT, ComponentT>::AddDependency(
 
-       target, context);
 
-     std::string result =
 
-       TargetFilesystemArtifactResultCreator<ArtifactT>::Create(target, context,
 
-                                                                content);
 
-     if (context->HadError) {
 
-       return std::string();
 
-     }
 
-     return TargetFilesystemArtifactResultGetter<ComponentT>::Get(result);
 
-   }
 
- };
 
- template <typename ArtifactT>
 
- struct TargetFilesystemArtifactNodeGroup
 
- {
 
-   TargetFilesystemArtifactNodeGroup() // NOLINT(modernize-use-equals-default)
 
-   {
 
-   }
 
-   TargetFilesystemArtifact<ArtifactT, ArtifactPathTag> File;
 
-   TargetFilesystemArtifact<ArtifactT, ArtifactNameTag> FileName;
 
-   TargetFilesystemArtifact<ArtifactT, ArtifactDirTag> FileDir;
 
- };
 
- static TargetFilesystemArtifactNodeGroup<ArtifactNameTag> const
 
-   targetNodeGroup;
 
- static TargetFilesystemArtifactNodeGroup<ArtifactImportTag> const
 
-   targetImportNodeGroup;
 
- static TargetFilesystemArtifactNodeGroup<ArtifactLinkerTag> const
 
-   targetLinkerNodeGroup;
 
- static TargetFilesystemArtifactNodeGroup<ArtifactLinkerLibraryTag> const
 
-   targetLinkerLibraryNodeGroup;
 
- static TargetFilesystemArtifactNodeGroup<ArtifactLinkerImportTag> const
 
-   targetLinkerImportNodeGroup;
 
- static TargetFilesystemArtifactNodeGroup<ArtifactSonameTag> const
 
-   targetSoNameNodeGroup;
 
- static TargetFilesystemArtifactNodeGroup<ArtifactSonameImportTag> const
 
-   targetSoNameImportNodeGroup;
 
- static TargetFilesystemArtifactNodeGroup<ArtifactPdbTag> const
 
-   targetPdbNodeGroup;
 
- static TargetFilesystemArtifact<ArtifactBundleDirTag, ArtifactPathTag> const
 
-   targetBundleDirNode;
 
- static TargetFilesystemArtifact<ArtifactBundleDirNameTag,
 
-                                 ArtifactNameTag> const targetBundleDirNameNode;
 
- static TargetFilesystemArtifact<ArtifactBundleContentDirTag,
 
-                                 ArtifactPathTag> const
 
-   targetBundleContentDirNode;
 
- //
 
- // To retrieve base name for various artifacts
 
- //
 
- template <typename ArtifactT>
 
- struct TargetOutputNameArtifactResultGetter
 
- {
 
-   static std::string Get(cmGeneratorTarget* target,
 
-                          cmGeneratorExpressionContext* context,
 
-                          GeneratorExpressionContent const* content);
 
- };
 
- template <>
 
- struct TargetOutputNameArtifactResultGetter<ArtifactNameTag>
 
- {
 
-   static std::string Get(cmGeneratorTarget* target,
 
-                          cmGeneratorExpressionContext* context,
 
-                          GeneratorExpressionContent const* /*unused*/)
 
-   {
 
-     return target->GetOutputName(context->Config,
 
-                                  cmStateEnums::RuntimeBinaryArtifact) +
 
-       target->GetFilePostfix(context->Config);
 
-   }
 
- };
 
- template <>
 
- struct TargetOutputNameArtifactResultGetter<ArtifactImportTag>
 
- {
 
-   static std::string Get(cmGeneratorTarget* target,
 
-                          cmGeneratorExpressionContext* context,
 
-                          GeneratorExpressionContent const* /*unused*/)
 
-   {
 
-     if (target->HasImportLibrary(context->Config)) {
 
-       return target->GetOutputName(context->Config,
 
-                                    cmStateEnums::ImportLibraryArtifact) +
 
-         target->GetFilePostfix(context->Config);
 
-     }
 
-     return std::string{};
 
-   }
 
- };
 
- template <>
 
- struct TargetOutputNameArtifactResultGetter<ArtifactLinkerTag>
 
- {
 
-   static std::string Get(cmGeneratorTarget* target,
 
-                          cmGeneratorExpressionContext* context,
 
-                          GeneratorExpressionContent const* content)
 
-   {
 
-     // The library file used to link to the target (.so, .lib, .a) or import
 
-     // file (.lin,  .tbd).
 
-     if (!target->IsLinkable()) {
 
-       ::reportError(context, content->GetOriginalExpression(),
 
-                     "TARGET_LINKER_FILE_BASE_NAME is allowed only for "
 
-                     "libraries and executables with ENABLE_EXPORTS.");
 
-       return std::string();
 
-     }
 
-     cmStateEnums::ArtifactType artifact =
 
-       target->HasImportLibrary(context->Config)
 
-       ? cmStateEnums::ImportLibraryArtifact
 
-       : cmStateEnums::RuntimeBinaryArtifact;
 
-     return target->GetOutputName(context->Config, artifact) +
 
-       target->GetFilePostfix(context->Config);
 
-   }
 
- };
 
- template <>
 
- struct TargetOutputNameArtifactResultGetter<ArtifactLinkerLibraryTag>
 
- {
 
-   static std::string Get(cmGeneratorTarget* target,
 
-                          cmGeneratorExpressionContext* context,
 
-                          GeneratorExpressionContent const* content)
 
-   {
 
-     // The library file used to link to the target (.so, .lib, .a).
 
-     if (!target->IsLinkable() ||
 
-         target->GetType() == cmStateEnums::EXECUTABLE) {
 
-       ::reportError(context, content->GetOriginalExpression(),
 
-                     "TARGET_LINKER_LIBRARY_FILE_BASE_NAME is allowed only for "
 
-                     "libraries with ENABLE_EXPORTS.");
 
-       return std::string();
 
-     }
 
-     if (!target->IsDLLPlatform() ||
 
-         target->GetType() == cmStateEnums::STATIC_LIBRARY) {
 
-       return target->GetOutputName(context->Config,
 
-                                    cmStateEnums::ImportLibraryArtifact) +
 
-         target->GetFilePostfix(context->Config);
 
-     }
 
-     return std::string{};
 
-   }
 
- };
 
- template <>
 
- struct TargetOutputNameArtifactResultGetter<ArtifactLinkerImportTag>
 
- {
 
-   static std::string Get(cmGeneratorTarget* target,
 
-                          cmGeneratorExpressionContext* context,
 
-                          GeneratorExpressionContent const* content)
 
-   {
 
-     // The import file used to link to the target (.lib, .tbd).
 
-     if (!target->IsLinkable()) {
 
-       ::reportError(context, content->GetOriginalExpression(),
 
-                     "TARGET_LINKER_IMPORT_FILE_BASE_NAME is allowed only for "
 
-                     "libraries and executables with ENABLE_EXPORTS.");
 
-       return std::string();
 
-     }
 
-     if (target->HasImportLibrary(context->Config)) {
 
-       return target->GetOutputName(context->Config,
 
-                                    cmStateEnums::ImportLibraryArtifact) +
 
-         target->GetFilePostfix(context->Config);
 
-     }
 
-     return std::string{};
 
-   }
 
- };
 
- template <>
 
- struct TargetOutputNameArtifactResultGetter<ArtifactPdbTag>
 
- {
 
-   static std::string Get(cmGeneratorTarget* target,
 
-                          cmGeneratorExpressionContext* context,
 
-                          GeneratorExpressionContent const* content)
 
-   {
 
-     if (target->IsImported()) {
 
-       ::reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "TARGET_PDB_FILE_BASE_NAME not allowed for IMPORTED targets.");
 
-       return std::string();
 
-     }
 
-     std::string language = target->GetLinkerLanguage(context->Config);
 
-     std::string pdbSupportVar = "CMAKE_" + language + "_LINKER_SUPPORTS_PDB";
 
-     if (!context->LG->GetMakefile()->IsOn(pdbSupportVar)) {
 
-       ::reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "TARGET_PDB_FILE_BASE_NAME is not supported by the target linker.");
 
-       return std::string();
 
-     }
 
-     cmStateEnums::TargetType targetType = target->GetType();
 
-     if (targetType != cmStateEnums::SHARED_LIBRARY &&
 
-         targetType != cmStateEnums::MODULE_LIBRARY &&
 
-         targetType != cmStateEnums::EXECUTABLE) {
 
-       ::reportError(context, content->GetOriginalExpression(),
 
-                     "TARGET_PDB_FILE_BASE_NAME is allowed only for "
 
-                     "targets with linker created artifacts.");
 
-       return std::string();
 
-     }
 
-     return target->GetPDBOutputName(context->Config) +
 
-       target->GetFilePostfix(context->Config);
 
-   }
 
- };
 
- template <typename ArtifactT>
 
- struct TargetFileBaseNameArtifact : public TargetArtifactBase
 
- {
 
-   TargetFileBaseNameArtifact() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return 1; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* dagChecker) const override
 
-   {
 
-     cmGeneratorTarget* target =
 
-       this->GetTarget(parameters, context, content, dagChecker);
 
-     if (!target) {
 
-       return std::string();
 
-     }
 
-     std::string result = TargetOutputNameArtifactResultGetter<ArtifactT>::Get(
 
-       target, context, content);
 
-     if (context->HadError) {
 
-       return std::string();
 
-     }
 
-     return result;
 
-   }
 
- };
 
- static TargetFileBaseNameArtifact<ArtifactNameTag> const
 
-   targetFileBaseNameNode;
 
- static TargetFileBaseNameArtifact<ArtifactImportTag> const
 
-   targetImportFileBaseNameNode;
 
- static TargetFileBaseNameArtifact<ArtifactLinkerTag> const
 
-   targetLinkerFileBaseNameNode;
 
- static TargetFileBaseNameArtifact<ArtifactLinkerLibraryTag> const
 
-   targetLinkerLibraryFileBaseNameNode;
 
- static TargetFileBaseNameArtifact<ArtifactLinkerImportTag> const
 
-   targetLinkerImportFileBaseNameNode;
 
- static TargetFileBaseNameArtifact<ArtifactPdbTag> const
 
-   targetPdbFileBaseNameNode;
 
- class ArtifactFilePrefixTag;
 
- class ArtifactImportFilePrefixTag;
 
- class ArtifactLinkerFilePrefixTag;
 
- class ArtifactLinkerLibraryFilePrefixTag;
 
- class ArtifactLinkerImportFilePrefixTag;
 
- class ArtifactFileSuffixTag;
 
- class ArtifactImportFileSuffixTag;
 
- class ArtifactLinkerFileSuffixTag;
 
- class ArtifactLinkerLibraryFileSuffixTag;
 
- class ArtifactLinkerImportFileSuffixTag;
 
- template <typename ArtifactT>
 
- struct TargetFileArtifactResultGetter
 
- {
 
-   static std::string Get(cmGeneratorTarget* target,
 
-                          cmGeneratorExpressionContext* context,
 
-                          GeneratorExpressionContent const* content);
 
- };
 
- template <>
 
- struct TargetFileArtifactResultGetter<ArtifactFilePrefixTag>
 
- {
 
-   static std::string Get(cmGeneratorTarget* target,
 
-                          cmGeneratorExpressionContext* context,
 
-                          GeneratorExpressionContent const*)
 
-   {
 
-     return target->GetFilePrefix(context->Config);
 
-   }
 
- };
 
- template <>
 
- struct TargetFileArtifactResultGetter<ArtifactImportFilePrefixTag>
 
- {
 
-   static std::string Get(cmGeneratorTarget* target,
 
-                          cmGeneratorExpressionContext* context,
 
-                          GeneratorExpressionContent const*)
 
-   {
 
-     if (target->HasImportLibrary(context->Config)) {
 
-       return target->GetFilePrefix(context->Config,
 
-                                    cmStateEnums::ImportLibraryArtifact);
 
-     }
 
-     return std::string{};
 
-   }
 
- };
 
- template <>
 
- struct TargetFileArtifactResultGetter<ArtifactLinkerFilePrefixTag>
 
- {
 
-   static std::string Get(cmGeneratorTarget* target,
 
-                          cmGeneratorExpressionContext* context,
 
-                          GeneratorExpressionContent const* content)
 
-   {
 
-     if (!target->IsLinkable()) {
 
-       ::reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "TARGET_LINKER_FILE_PREFIX is allowed only for libraries and "
 
-         "executables with ENABLE_EXPORTS.");
 
-       return std::string();
 
-     }
 
-     cmStateEnums::ArtifactType artifact =
 
-       target->HasImportLibrary(context->Config)
 
-       ? cmStateEnums::ImportLibraryArtifact
 
-       : cmStateEnums::RuntimeBinaryArtifact;
 
-     return target->GetFilePrefix(context->Config, artifact);
 
-   }
 
- };
 
- template <>
 
- struct TargetFileArtifactResultGetter<ArtifactLinkerLibraryFilePrefixTag>
 
- {
 
-   static std::string Get(cmGeneratorTarget* target,
 
-                          cmGeneratorExpressionContext* context,
 
-                          GeneratorExpressionContent const* content)
 
-   {
 
-     if (!target->IsLinkable() ||
 
-         target->GetType() == cmStateEnums::EXECUTABLE) {
 
-       ::reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "TARGET_LINKER_LIBRARY_FILE_PREFIX is allowed only for libraries "
 
-         "with ENABLE_EXPORTS.");
 
-       return std::string();
 
-     }
 
-     if (!target->IsDLLPlatform() ||
 
-         target->GetType() == cmStateEnums::STATIC_LIBRARY) {
 
-       return target->GetFilePrefix(context->Config,
 
-                                    cmStateEnums::RuntimeBinaryArtifact);
 
-     }
 
-     return std::string{};
 
-   }
 
- };
 
- template <>
 
- struct TargetFileArtifactResultGetter<ArtifactLinkerImportFilePrefixTag>
 
- {
 
-   static std::string Get(cmGeneratorTarget* target,
 
-                          cmGeneratorExpressionContext* context,
 
-                          GeneratorExpressionContent const* content)
 
-   {
 
-     if (!target->IsLinkable()) {
 
-       ::reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "TARGET_LINKER_IMPORT_FILE_PREFIX is allowed only for libraries and "
 
-         "executables with ENABLE_EXPORTS.");
 
-       return std::string();
 
-     }
 
-     if (target->HasImportLibrary(context->Config)) {
 
-       return target->GetFilePrefix(context->Config,
 
-                                    cmStateEnums::ImportLibraryArtifact);
 
-     }
 
-     return std::string{};
 
-   }
 
- };
 
- template <>
 
- struct TargetFileArtifactResultGetter<ArtifactFileSuffixTag>
 
- {
 
-   static std::string Get(cmGeneratorTarget* target,
 
-                          cmGeneratorExpressionContext* context,
 
-                          GeneratorExpressionContent const*)
 
-   {
 
-     return target->GetFileSuffix(context->Config);
 
-   }
 
- };
 
- template <>
 
- struct TargetFileArtifactResultGetter<ArtifactImportFileSuffixTag>
 
- {
 
-   static std::string Get(cmGeneratorTarget* target,
 
-                          cmGeneratorExpressionContext* context,
 
-                          GeneratorExpressionContent const*)
 
-   {
 
-     if (target->HasImportLibrary(context->Config)) {
 
-       return target->GetFileSuffix(context->Config,
 
-                                    cmStateEnums::ImportLibraryArtifact);
 
-     }
 
-     return std::string{};
 
-   }
 
- };
 
- template <>
 
- struct TargetFileArtifactResultGetter<ArtifactLinkerFileSuffixTag>
 
- {
 
-   static std::string Get(cmGeneratorTarget* target,
 
-                          cmGeneratorExpressionContext* context,
 
-                          GeneratorExpressionContent const* content)
 
-   {
 
-     if (!target->IsLinkable()) {
 
-       ::reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "TARGET_LINKER_FILE_SUFFIX is allowed only for libraries and "
 
-         "executables with ENABLE_EXPORTS.");
 
-       return std::string();
 
-     }
 
-     cmStateEnums::ArtifactType artifact =
 
-       target->HasImportLibrary(context->Config)
 
-       ? cmStateEnums::ImportLibraryArtifact
 
-       : cmStateEnums::RuntimeBinaryArtifact;
 
-     return target->GetFileSuffix(context->Config, artifact);
 
-   }
 
- };
 
- template <>
 
- struct TargetFileArtifactResultGetter<ArtifactLinkerLibraryFileSuffixTag>
 
- {
 
-   static std::string Get(cmGeneratorTarget* target,
 
-                          cmGeneratorExpressionContext* context,
 
-                          GeneratorExpressionContent const* content)
 
-   {
 
-     if (!target->IsLinkable() ||
 
-         target->GetType() == cmStateEnums::STATIC_LIBRARY) {
 
-       ::reportError(context, content->GetOriginalExpression(),
 
-                     "TARGET_LINKER_LIBRARY_FILE_SUFFIX is allowed only for "
 
-                     "libraries with ENABLE_EXPORTS.");
 
-       return std::string();
 
-     }
 
-     if (!target->IsDLLPlatform() ||
 
-         target->GetType() == cmStateEnums::STATIC_LIBRARY) {
 
-       return target->GetFileSuffix(context->Config,
 
-                                    cmStateEnums::RuntimeBinaryArtifact);
 
-     }
 
-     return std::string{};
 
-   }
 
- };
 
- template <>
 
- struct TargetFileArtifactResultGetter<ArtifactLinkerImportFileSuffixTag>
 
- {
 
-   static std::string Get(cmGeneratorTarget* target,
 
-                          cmGeneratorExpressionContext* context,
 
-                          GeneratorExpressionContent const* content)
 
-   {
 
-     if (!target->IsLinkable()) {
 
-       ::reportError(
 
-         context, content->GetOriginalExpression(),
 
-         "TARGET_LINKER_IMPORT_FILE_SUFFIX is allowed only for libraries and "
 
-         "executables with ENABLE_EXPORTS.");
 
-       return std::string();
 
-     }
 
-     if (target->HasImportLibrary(context->Config)) {
 
-       return target->GetFileSuffix(context->Config,
 
-                                    cmStateEnums::ImportLibraryArtifact);
 
-     }
 
-     return std::string{};
 
-   }
 
- };
 
- template <typename ArtifactT>
 
- struct TargetFileArtifact : public TargetArtifactBase
 
- {
 
-   TargetFileArtifact() {} // NOLINT(modernize-use-equals-default)
 
-   int NumExpectedParameters() const override { return 1; }
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* dagChecker) const override
 
-   {
 
-     cmGeneratorTarget* target =
 
-       this->GetTarget(parameters, context, content, dagChecker);
 
-     if (!target) {
 
-       return std::string();
 
-     }
 
-     std::string result =
 
-       TargetFileArtifactResultGetter<ArtifactT>::Get(target, context, content);
 
-     if (context->HadError) {
 
-       return std::string();
 
-     }
 
-     return result;
 
-   }
 
- };
 
- static TargetFileArtifact<ArtifactFilePrefixTag> const targetFilePrefixNode;
 
- static TargetFileArtifact<ArtifactImportFilePrefixTag> const
 
-   targetImportFilePrefixNode;
 
- static TargetFileArtifact<ArtifactLinkerFilePrefixTag> const
 
-   targetLinkerFilePrefixNode;
 
- static TargetFileArtifact<ArtifactLinkerLibraryFilePrefixTag> const
 
-   targetLinkerLibraryFilePrefixNode;
 
- static TargetFileArtifact<ArtifactLinkerImportFilePrefixTag> const
 
-   targetLinkerImportFilePrefixNode;
 
- static TargetFileArtifact<ArtifactFileSuffixTag> const targetFileSuffixNode;
 
- static TargetFileArtifact<ArtifactImportFileSuffixTag> const
 
-   targetImportFileSuffixNode;
 
- static TargetFileArtifact<ArtifactLinkerFileSuffixTag> const
 
-   targetLinkerFileSuffixNode;
 
- static TargetFileArtifact<ArtifactLinkerLibraryFileSuffixTag> const
 
-   targetLinkerLibraryFileSuffixNode;
 
- static TargetFileArtifact<ArtifactLinkerImportFileSuffixTag> const
 
-   targetLinkerImportFileSuffixNode;
 
- static const struct ShellPathNode : public cmGeneratorExpressionNode
 
- {
 
-   ShellPathNode() {} // NOLINT(modernize-use-equals-default)
 
-   std::string Evaluate(
 
-     std::vector<std::string> const& parameters,
 
-     cmGeneratorExpressionContext* context,
 
-     GeneratorExpressionContent const* content,
 
-     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
 
-   {
 
-     cmList list_in{ parameters.front() };
 
-     if (list_in.empty()) {
 
-       reportError(context, content->GetOriginalExpression(),
 
-                   "\"\" is not an absolute path.");
 
-       return std::string();
 
-     }
 
-     cmStateSnapshot snapshot = context->LG->GetStateSnapshot();
 
-     cmOutputConverter converter(snapshot);
 
-     char const* separator = snapshot.GetState()->UseWindowsShell() ? ";" : ":";
 
-     std::vector<std::string> list_out;
 
-     list_out.reserve(list_in.size());
 
-     for (auto const& in : list_in) {
 
-       if (!cmSystemTools::FileIsFullPath(in)) {
 
-         reportError(context, content->GetOriginalExpression(),
 
-                     "\"" + in + "\" is not an absolute path.");
 
-         return std::string();
 
-       }
 
-       list_out.emplace_back(converter.ConvertDirectorySeparatorsForShell(in));
 
-     }
 
-     return cmJoin(list_out, separator);
 
-   }
 
- } shellPathNode;
 
- cmGeneratorExpressionNode const* cmGeneratorExpressionNode::GetNode(
 
-   std::string const& identifier)
 
- {
 
-   static std::map<std::string, cmGeneratorExpressionNode const*> const nodeMap{
 
-     { "0", &zeroNode },
 
-     { "1", &oneNode },
 
-     { "AND", &andNode },
 
-     { "OR", &orNode },
 
-     { "NOT", ¬Node },
 
-     { "C_COMPILER_ID", &cCompilerIdNode },
 
-     { "CXX_COMPILER_ID", &cxxCompilerIdNode },
 
-     { "OBJC_COMPILER_ID", &objcCompilerIdNode },
 
-     { "OBJCXX_COMPILER_ID", &objcxxCompilerIdNode },
 
-     { "CUDA_COMPILER_ID", &cudaCompilerIdNode },
 
-     { "Fortran_COMPILER_ID", &fortranCompilerIdNode },
 
-     { "HIP_COMPILER_ID", &hipCompilerIdNode },
 
-     { "VERSION_GREATER", &versionGreaterNode },
 
-     { "VERSION_GREATER_EQUAL", &versionGreaterEqNode },
 
-     { "VERSION_LESS", &versionLessNode },
 
-     { "VERSION_LESS_EQUAL", &versionLessEqNode },
 
-     { "VERSION_EQUAL", &versionEqualNode },
 
-     { "C_COMPILER_VERSION", &cCompilerVersionNode },
 
-     { "CXX_COMPILER_VERSION", &cxxCompilerVersionNode },
 
-     { "CUDA_COMPILER_VERSION", &cudaCompilerVersionNode },
 
-     { "OBJC_COMPILER_VERSION", &objcCompilerVersionNode },
 
-     { "OBJCXX_COMPILER_VERSION", &objcxxCompilerVersionNode },
 
-     { "Fortran_COMPILER_VERSION", &fortranCompilerVersionNode },
 
-     { "HIP_COMPILER_VERSION", &hipCompilerVersionNode },
 
-     { "C_COMPILER_FRONTEND_VARIANT", &cCompilerFrontendVariantNode },
 
-     { "CXX_COMPILER_FRONTEND_VARIANT", &cxxCompilerFrontendVariantNode },
 
-     { "CUDA_COMPILER_FRONTEND_VARIANT", &cudaCompilerFrontendVariantNode },
 
-     { "OBJC_COMPILER_FRONTEND_VARIANT", &objcCompilerFrontendVariantNode },
 
-     { "OBJCXX_COMPILER_FRONTEND_VARIANT", &objcxxCompilerFrontendVariantNode },
 
-     { "Fortran_COMPILER_FRONTEND_VARIANT",
 
-       &fortranCompilerFrontendVariantNode },
 
-     { "HIP_COMPILER_FRONTEND_VARIANT", &hipCompilerFrontendVariantNode },
 
-     { "PLATFORM_ID", &platformIdNode },
 
-     { "COMPILE_FEATURES", &compileFeaturesNode },
 
-     { "CONFIGURATION", &configurationNode },
 
-     { "CONFIG", &configurationTestNode },
 
-     { "TARGET_FILE", &targetNodeGroup.File },
 
-     { "TARGET_IMPORT_FILE", &targetImportNodeGroup.File },
 
-     { "TARGET_LINKER_FILE", &targetLinkerNodeGroup.File },
 
-     { "TARGET_LINKER_LIBRARY_FILE", &targetLinkerLibraryNodeGroup.File },
 
-     { "TARGET_LINKER_IMPORT_FILE", &targetLinkerImportNodeGroup.File },
 
-     { "TARGET_SONAME_FILE", &targetSoNameNodeGroup.File },
 
-     { "TARGET_SONAME_IMPORT_FILE", &targetSoNameImportNodeGroup.File },
 
-     { "TARGET_PDB_FILE", &targetPdbNodeGroup.File },
 
-     { "TARGET_FILE_BASE_NAME", &targetFileBaseNameNode },
 
-     { "TARGET_IMPORT_FILE_BASE_NAME", &targetImportFileBaseNameNode },
 
-     { "TARGET_LINKER_FILE_BASE_NAME", &targetLinkerFileBaseNameNode },
 
-     { "TARGET_LINKER_LIBRARY_FILE_BASE_NAME",
 
-       &targetLinkerLibraryFileBaseNameNode },
 
-     { "TARGET_LINKER_IMPORT_FILE_BASE_NAME",
 
-       &targetLinkerImportFileBaseNameNode },
 
-     { "TARGET_PDB_FILE_BASE_NAME", &targetPdbFileBaseNameNode },
 
-     { "TARGET_FILE_PREFIX", &targetFilePrefixNode },
 
-     { "TARGET_IMPORT_FILE_PREFIX", &targetImportFilePrefixNode },
 
-     { "TARGET_LINKER_FILE_PREFIX", &targetLinkerFilePrefixNode },
 
-     { "TARGET_LINKER_LIBRARY_FILE_PREFIX",
 
-       &targetLinkerLibraryFilePrefixNode },
 
-     { "TARGET_LINKER_IMPORT_FILE_PREFIX", &targetLinkerImportFilePrefixNode },
 
-     { "TARGET_FILE_SUFFIX", &targetFileSuffixNode },
 
-     { "TARGET_IMPORT_FILE_SUFFIX", &targetImportFileSuffixNode },
 
-     { "TARGET_LINKER_FILE_SUFFIX", &targetLinkerFileSuffixNode },
 
-     { "TARGET_LINKER_LIBRARY_FILE_SUFFIX",
 
-       &targetLinkerLibraryFileSuffixNode },
 
-     { "TARGET_LINKER_IMPORT_FILE_SUFFIX", &targetLinkerImportFileSuffixNode },
 
-     { "TARGET_FILE_NAME", &targetNodeGroup.FileName },
 
-     { "TARGET_IMPORT_FILE_NAME", &targetImportNodeGroup.FileName },
 
-     { "TARGET_LINKER_FILE_NAME", &targetLinkerNodeGroup.FileName },
 
-     { "TARGET_LINKER_LIBRARY_FILE_NAME",
 
-       &targetLinkerLibraryNodeGroup.FileName },
 
-     { "TARGET_LINKER_IMPORT_FILE_NAME",
 
-       &targetLinkerImportNodeGroup.FileName },
 
-     { "TARGET_SONAME_FILE_NAME", &targetSoNameNodeGroup.FileName },
 
-     { "TARGET_SONAME_IMPORT_FILE_NAME",
 
-       &targetSoNameImportNodeGroup.FileName },
 
-     { "TARGET_PDB_FILE_NAME", &targetPdbNodeGroup.FileName },
 
-     { "TARGET_FILE_DIR", &targetNodeGroup.FileDir },
 
-     { "TARGET_IMPORT_FILE_DIR", &targetImportNodeGroup.FileDir },
 
-     { "TARGET_LINKER_FILE_DIR", &targetLinkerNodeGroup.FileDir },
 
-     { "TARGET_LINKER_LIBRARY_FILE_DIR",
 
-       &targetLinkerLibraryNodeGroup.FileDir },
 
-     { "TARGET_LINKER_IMPORT_FILE_DIR", &targetLinkerImportNodeGroup.FileDir },
 
-     { "TARGET_SONAME_FILE_DIR", &targetSoNameNodeGroup.FileDir },
 
-     { "TARGET_SONAME_IMPORT_FILE_DIR", &targetSoNameImportNodeGroup.FileDir },
 
-     { "TARGET_PDB_FILE_DIR", &targetPdbNodeGroup.FileDir },
 
-     { "TARGET_BUNDLE_DIR", &targetBundleDirNode },
 
-     { "TARGET_BUNDLE_DIR_NAME", &targetBundleDirNameNode },
 
-     { "TARGET_BUNDLE_CONTENT_DIR", &targetBundleContentDirNode },
 
-     { "STREQUAL", &strEqualNode },
 
-     { "EQUAL", &equalNode },
 
-     { "IN_LIST", &inListNode },
 
-     { "FILTER", &filterNode },
 
-     { "REMOVE_DUPLICATES", &removeDuplicatesNode },
 
-     { "LIST", &listNode },
 
-     { "LOWER_CASE", &lowerCaseNode },
 
-     { "UPPER_CASE", &upperCaseNode },
 
-     { "PATH", &pathNode },
 
-     { "PATH_EQUAL", &pathEqualNode },
 
-     { "MAKE_C_IDENTIFIER", &makeCIdentifierNode },
 
-     { "BOOL", &boolNode },
 
-     { "IF", &ifNode },
 
-     { "ANGLE-R", &angle_rNode },
 
-     { "COMMA", &commaNode },
 
-     { "SEMICOLON", &semicolonNode },
 
-     { "QUOTE", "eNode },
 
-     { "TARGET_PROPERTY", &targetPropertyNode },
 
-     { "TARGET_NAME", &targetNameNode },
 
-     { "TARGET_OBJECTS", &targetObjectsNode },
 
-     { "TARGET_POLICY", &targetPolicyNode },
 
-     { "TARGET_EXISTS", &targetExistsNode },
 
-     { "TARGET_NAME_IF_EXISTS", &targetNameIfExistsNode },
 
-     { "TARGET_GENEX_EVAL", &targetGenexEvalNode },
 
-     { "TARGET_RUNTIME_DLLS", &targetRuntimeDllsNode },
 
-     { "TARGET_RUNTIME_DLL_DIRS", &targetRuntimeDllDirsNode },
 
-     { "GENEX_EVAL", &genexEvalNode },
 
-     { "BUILD_INTERFACE", &buildInterfaceNode },
 
-     { "INSTALL_INTERFACE", &installInterfaceNode },
 
-     { "BUILD_LOCAL_INTERFACE", &buildLocalInterfaceNode },
 
-     { "INSTALL_PREFIX", &installPrefixNode },
 
-     { "JOIN", &joinNode },
 
-     { "COMPILE_ONLY", &compileOnlyNode },
 
-     { "LINK_ONLY", &linkOnlyNode },
 
-     { "COMPILE_LANG_AND_ID", &languageAndIdNode },
 
-     { "COMPILE_LANGUAGE", &languageNode },
 
-     { "LINK_LANG_AND_ID", &linkLanguageAndIdNode },
 
-     { "LINK_LANGUAGE", &linkLanguageNode },
 
-     { "LINK_LIBRARY", &linkLibraryNode },
 
-     { "LINK_GROUP", &linkGroupNode },
 
-     { "HOST_LINK", &hostLinkNode },
 
-     { "DEVICE_LINK", &deviceLinkNode },
 
-     { "SHELL_PATH", &shellPathNode }
 
-   };
 
-   {
 
-     auto itr = nodeMap.find(identifier);
 
-     if (itr != nodeMap.end()) {
 
-       return itr->second;
 
-     }
 
-   }
 
-   return nullptr;
 
- }
 
- void reportError(cmGeneratorExpressionContext* context,
 
-                  std::string const& expr, std::string const& result)
 
- {
 
-   context->HadError = true;
 
-   if (context->Quiet) {
 
-     return;
 
-   }
 
-   std::ostringstream e;
 
-   /* clang-format off */
 
-   e << "Error evaluating generator expression:\n"
 
-     << "  " << expr << "\n"
 
-     << result;
 
-   /* clang-format on */
 
-   context->LG->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR,
 
-                                                 e.str(), context->Backtrace);
 
- }
 
 
  |