CMakeLists: use list(APPEND) for CMAKE_MODULE_PATH#550
Conversation
set() silently discards any -DCMAKE_MODULE_PATH=... passed by a parent or superbuild system. list(APPEND) preserves those paths while still registering Silo's own CMake/ directory, which is standard CMake practice for project-internal module directories.
|
Thanks for this PR 💪. Will merge tomorrow and backport to Just curious, was anything about this PR AI-assisted? |
|
The entire thing, minus a final pass by me. |
Ok, thanks for following up with that. I can't put my finger on it but the PR commit comment read like it was. FWIW, because the use of AI is very much a topic of substantial discussion especially in open source code development, I myself am pretty sheepish about submitting any work or information to others that is derived even in part from AI assistance without at least attributing it as such...if for no other reason that I might inadvertently giving the others the impression I am more skilled than I a actually am 😉. |
|
@markcmiller86 I'm sympathetic to that view. I worry less about the skilled part than just making silly mistakes the reviewer won't notice. Usually, I only do this on my own code, so I don't have to dwell on the idea much. In cases where I've made PRs to others' code, they've all been one- or two-line changes or backed by their existing tests, so I worry a bit less. If the maintainer can't review a one-line change, something else is surely amiss! |
Problem
CMakeLists.txtcurrently usesset()to register Silo's CMake module directory:set()replacesCMAKE_MODULE_PATHentirely, silently discarding any value passed by a parent or superbuild system via-DCMAKE_MODULE_PATH=.... This means any customFindXXX.cmakemodules injected by the parent are lost beforeSiloFindHDF5.cmakeruns.Impact
This breaks superbuild systems that embed Silo as a dependency and need to inject custom CMake finders for non-standard environments. A concrete example: MFC, an exascale CFD solver, targets Cray HPC clusters where CMake's built-in
FindHDF5.cmakedoes not locate HDF5 correctly. MFC injects a Cray-specific finder via-DCMAKE_MODULE_PATH=.... With the currentset(), that path is wiped out, and the build fails:MFC currently works around this by patching Silo at build time, but that patch exists solely because of this one line.
Fix
Change
set()tolist(APPEND):This preserves any externally-set module paths while still making Silo's own
CMake/directory available — standard CMake practice for project-internal module directories.No behavior change for standalone Silo builds where
CMAKE_MODULE_PATHis empty or unset at entry.