graph TD subgraph Portfolio["28 C++ Repos"] P1["ckpttn-cpp"] --> P2["netlistx-cpp"] P2 --> P3["xnetwork-cpp"] P3 --> P4["py2cpp"] P1 --> P5["digraphx-cpp"] P5 --> P6["netoptim-cpp"] P6 --> P7["ellalgo-cpp"] P8["fractions-cpp"] --> P9["projgeom-cpp"] P9 --> P10["rat-trig-cpp"] end style Portfolio fill:#e8f5e9,stroke:#2e7d32,stroke-width:3px style P1 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style P6 fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style P8 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px
graph LR subgraph Idiom1["Idiom 1 β set(CPM_fmt_ADDED YES)"] A1["ecgen, lmi-solver, mywheel\npy2cpp, xnetwork, csd\nnetlistx, ellalgo"] end subgraph Idiom2["Idiom 2 β list(APPEND CPM_PACKAGES fmt)"] A2["corr-solver, multiplierless"] end subgraph Idiom3["Idiom 3 β No guard at all"] A3["ckpttn, ginger, netoptim\nprojgeom, sphere-n, digraphx\nphysdes"] end Idiom1 --> Q{"Which one\nis correct?"} Idiom2 --> Q Idiom3 --> Q Q --> R["β Ask CPM's source code..."] style Idiom1 fill:#fff3e0,stroke:#e65100,stroke-width:3px style Idiom2 fill:#fff3e0,stroke:#e65100,stroke-width:3px style Idiom3 fill:#fff3e0,stroke:#e65100,stroke-width:3px style Q fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style R fill:#e3f2fd,stroke:#1565c0,stroke-width:3px
graph LR subgraph Producers["Producer Repos"] A["py2cpp\nv1.6.3"] B["ellalgo-cpp\nv1.6.8"] C["fractions-cpp\nv1.1.3"] end subgraph Consumers["Consumer Repos"] D["xnetwork, ecgen, mywheel..."] E["corr-solver, lmi-solver..."] F["projgeom, rat-trig"] end A --> D B --> E C --> F style Producers fill:#e8f5e9,stroke:#2e7d32,stroke-width:3px style Consumers fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style A fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style B fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style C fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px
graph LR A["CPMAddPackage\n(Py2Cpp)"] --> B{"Py2Cpp IN_LIST\nCPM_PACKAGES?"} B -- "No β" --> C["cpm_find_package"] C --> D["find_package(Py2Cpp)"] D --> E["FindPy2Cpp.cmake\n(generated module)"] E --> A style A fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style B fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px style C fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px style D fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px style E fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px
graph LR A["netoptim-fast specific.cmake\nfind_package(fmt) β system"] --> B["fmt::fmt = IMPORTED β "] C["fetched DiGraphXFast\nCPMAddPackage(fmt) unguarded"] --> D["CPM fetches fmt\ncreates fmt::fmt ALIAS"] B --> E["CONFLICT π₯"] D --> E style A fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style B fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style C fill:#fff3e0,stroke:#e65100,stroke-width:3px style D fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style E fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px
graph TD A["netoptim-cpp specific.cmake"] --> B["CPMAddPackage(DiGraphX)"] B --> C["DiGraphX CPM-adds abseil-cpp\nβ REAL absl::* targets"] A --> D["find_package(absl)\nconda system absl"] D --> E["β IMPORTED absl::* targets"] C --> F["CONFLICT π₯\nREAL vs IMPORTED"] E --> F style A fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style B fill:#fff3e0,stroke:#e65100,stroke-width:3px style C fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style D fill:#fff3e0,stroke:#e65100,stroke-width:3px style E fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style F fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px
graph TD A["list(APPEND CPM_PACKAGES fmt)"] --> B["Reads CACHE = empty"] B --> C["Creates NORMAL var\nCPM_PACKAGES = [fmt]"] C --> D["NORMAL var shadows CACHE\nin current + child scopes"] style A fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style B fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style C fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px style D fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px
graph TD subgraph Parent["Parent Scope (specific.cmake)"] N1["NORMAL var: [fmt]\n(shadow, from my list(APPEND))"] end subgraph Cache["CACHE INTERNAL (global)"] C1["[fmt;Py2Cpp]\n(CPM registered Py2Cpp here)"] end subgraph Child["FetchContent subdirectory\n(fetched dep's specific.cmake)"] Q{"Py2Cpp IN_LIST\nCPM_PACKAGES?"} end N1 -->|"inherited β"| Q C1 -.->|"shadowed β"| Q Q -->|"No β recursion π₯"| R["find_package(Py2Cpp)\nβ FindPy2Cpp.cmake\nβ CPMAddPackage\nβ infinite loop"] style N1 fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px style C1 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style Q fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style R fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px
graph TD A["I applied\nlist(APPEND CPM_PACKAGES fmt)"] --> B["Normal-var shadow\nhides cache in child scopes"] B --> C["Fetched dep checks CPM_PACKAGES\nβ Py2Cpp not found"] C --> D["find_package β FindPy2Cpp.cmake\nβ CPMAddPackage β recursion π₯"] D --> E["Fix: set(... CACHE INTERNAL '' FORCE)"] E --> F["Value propagates everywhere\n28 repos build β "] style A fill:#fff3e0,stroke:#e65100,stroke-width:3px style B fill:#fff3e0,stroke:#e65100,color:#2e3440,stroke-width:3px style C fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px style D fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px style E fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style F fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px
graph TD subgraph Cost["Cost of Guessing π₯"] G1["β 3 error classes"] --> G2["β 28 repos Γ 2 builds"] G2 --> G3["β 1 hour machine time"] end subgraph Better["Better Approach π‘"] B1["β Stop. Read CPM source."] --> B2["β Treat doc warnings as constraints"] B2 --> B3["β Minimal repro first"] B3 --> B4["β Isolate my bugs via git stash"] B4 --> B5["β Apply ONE correct idiom"] end Cost --> Better style Cost fill:#fce4ec,stroke:#ad1457,stroke-width:3px style Better fill:#e8f5e9,stroke:#2e7d32,stroke-width:3px style G1 fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px style G2 fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px style G3 fill:#ffcdd2,stroke:#c62828,color:#2e3440,stroke-width:3px style B1 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style B2 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style B3 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style B4 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px style B5 fill:#c8e6c9,stroke:#2e7d32,color:#2e3440,stroke-width:3px