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 style P1 fill:#4caf50,color:#fff style P6 fill:#ff9800,color:#fff style P8 fill:#4caf50,color:#fff
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 style Idiom2 fill:#fff3e0 style Idiom3 fill:#fff3e0 style Q fill:#ff9800,color:#fff style R fill:#e3f2fd
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 style Consumers fill:#e3f2fd style A fill:#4caf50,color:#fff style B fill:#4caf50,color:#fff style C fill:#4caf50,color:#fff
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:#ff9800,color:#fff style B fill:#f44336,color:#fff style C fill:#f44336,color:#fff style D fill:#f44336,color:#fff style E fill:#f44336,color:#fff
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 style B fill:#4caf50,color:#fff style C fill:#fff3e0 style D fill:#ff9800,color:#fff style E fill:#f44336,color:#fff
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 style B fill:#fff3e0 style C fill:#ff9800,color:#fff style D fill:#fff3e0 style E fill:#ff9800,color:#fff style F fill:#f44336,color:#fff
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:#ff9800,color:#fff style B fill:#e3f2fd style C fill:#f44336,color:#fff style D fill:#f44336,color:#fff
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:#f44336,color:#fff style C1 fill:#4caf50,color:#fff style Q fill:#ff9800,color:#fff style R fill:#f44336,color:#fff
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 style B fill:#ff9800,color:#fff style C fill:#f44336,color:#fff style D fill:#f44336,color:#fff style E fill:#4caf50,color:#fff style F fill:#4caf50,color:#fff
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:#f44336 style Better fill:#e8f5e9,stroke:#4caf50 style G1 fill:#f44336,color:#fff style G2 fill:#f44336,color:#fff style G3 fill:#f44336,color:#fff style B1 fill:#4caf50,color:#fff style B2 fill:#4caf50,color:#fff style B3 fill:#4caf50,color:#fff style B4 fill:#4caf50,color:#fff style B5 fill:#4caf50,color:#fff