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
[x] Code is formatted. (You can use the format_spiner make target.)
[x] Adds a test for any bugs fixed. Adds tests for new features.
[x] If preparing for a new release, update the version in cmake.
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 afetch + add_subdirectory
that was triggering the error. This logic extends to also preventfind_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 incmake@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 withcmake@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