if CPM_LOCAL_PACKAGES_ONLY, make find_package fail if it failed to find.#589
if CPM_LOCAL_PACKAGES_ONLY, make find_package fail if it failed to find.#589Arniiiii wants to merge 4 commits intocpm-cmake:masterfrom
find_package fail if it failed to find.#589Conversation
It seems like you called I'm not a fan of forcing
I think this behavior comes down to personal preference. I prefer CPM to download all dependencies while I make ☕, regardless of whether an error occurs. Lines 719 to 734 in 011d3dd If a local package isn't found and CPM falls back to FetchContent, we still print a warning. However, since this fallback is intentional and part of CPM's functionality, the warning might confuse users.
I`m not a maintainer, just interested in helping out wherever I can. |
I've called
I thought that adding the keyword is logically correct ( with that PR ) :
How it is now:
FYI :
That's why
In such case, use not
Yep, I agree that the warning is now still not good enough. I will add right now to the warning message something like "The warning emitted bacause CPM_USE_LOCAL_PACKAGES is set to ${CPM_USE_LOCAL_PACKAGES} . Falling back to downloading the package." |
|
Also thanks for reminding about |
I've found that if using CPM_LOCAL_PACKAGES_ONLY , it will make
message(SEND_ERROR ...)about failure.https://cmake.org/cmake/help/latest/command/message.html
message(SEND_ERROR ...)not fails immediately, which makes CPM go further and download the package, though not allowing to generatefind_package.Firstly I thought to change
message(SEND_ERROR ...tomessage(FATAL_ERROR ...)But my real problem was that
find_packagehave found a package with specified version, but not some of its components.IDK how to get error message from
find_package, that's why I've made that if CPM_LOCAL_PACKAGES_ONLY to just askfind_packageto fail if it failed, and show its error logs by itself. And that's just by addingREQUIRED.