Standardize package found logic for tpls#429
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes how EKAT decides whether to fetch/build certain third-party
libraries (TPLs) by standardizing the decision logic on <pkg>_FOUND, and it
ensures yaml-cpp::yaml-cpp is available to downstream consumers via EKAT’s
installed CMake config.
Changes:
- Switch Catch2/yaml-cpp/spdlog FetchContent decisions to use
<pkg>_FOUND. - Ensure
<pkg>_FOUNDis set whenEKAT_SKIP_FIND_<PKG>is enabled. - Add downstream
yaml-cpp::yaml-cppalias creation inEkatConfig.cmake.in.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/testing-support/CMakeLists.txt | Uses Catch2_FOUND to decide whether to FetchContent Catch2. |
| src/parser/CMakeLists.txt | Uses yaml-cpp_FOUND to decide whether to FetchContent yaml-cpp. |
| src/logging/CMakeLists.txt | Uses spdlog_FOUND to decide whether to FetchContent spdlog. |
| cmake/EkatConfig.cmake.in | Ensures yaml-cpp::yaml-cpp exists for downstream consumers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
The last version should be extra-extra safe:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
7d02f32 to
2fbec94
Compare
2fbec94 to
9b088bb
Compare
|
I built e3sm with this version of ekat on my workstation, and it builds fine. |
jeff-cohere
left a comment
There was a problem hiding this comment.
I have one question about an empty if block. But the rest looks good to me.
Motivation
As shown in the failed CI runs for
eamxx-v1workflow in E3SM-Project/E3SM#8258, there is an issue with how we decide whether to fetch and install yaml-cpp. Namely, if the pkg is found, and only provides the (nicely) scopedyaml-cpp::yaml-cpptarget, the if condition that establish whether to call FetchContent is wrong. This PR changes it to be more robust, for all the three packages: ensure that _FOUND is always set, and use that to decide whether to use FetchContent.Side fix: if the yaml-cpp pkg is found but does not define the scoped tgt, we create the scoped one ourselves. But we were not propagating this to the installed EkatConfig.cmake, so downstream tgt would not know what yaml-cpp::yaml-cpp was (again, only for the case where a pre-installed yaml-cpp did NOT define the scoped tgt). To fix this, I added the same logic to our EkatConfig.cmake.in file, so that the scoped target is guaranteed to exist for downstream customers.
E3SM Stakeholder Feedback
Testing