lanl / spiner

Performance portable routines for generic, tabulated, multi-dimensional data
https://lanl.github.io/spiner
BSD 3-Clause "New" or "Revised" License
7 stars 3 forks source link

Fix "already present target" error when using submodules #69

Closed mauneyc-LANL closed 1 year ago

mauneyc-LANL commented 1 year ago

PR Summary

When used as a submodule downstream, the build would get unruly about ports-of-call target being included twice. This PR inserts a per-package flag that is set when a requested target is already defined in the build, and this flag prevents doing a fetch + add_subdirectory that was triggering the error. This logic extends to also prevent find_package from triggering.

Originally, the CMake code currently deployed in spiner was meant to interact with a similar system up/downstream that would "globally" handle situations like these, as is done in cmake@3.24 and later releases. However, this ended up being a challenge to develop across project boundaries, and a decision was made to just wait for consuming codes to get up to speed with cmake@3.24+, which will provide this functionality natively.

On a side-note, this, along with #68 from @jonahm-LANL , are incorporated into my singularity-eos update.

PR Checklist