Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

find_package(Slint) never succeed even after FetchContent_MakeAvailable #16

Closed
Centaur opened this issue Oct 18, 2023 · 7 comments · May be fixed by #17
Closed

find_package(Slint) never succeed even after FetchContent_MakeAvailable #16

Centaur opened this issue Oct 18, 2023 · 7 comments · May be fixed by #17

Comments

@Centaur
Copy link

Centaur commented Oct 18, 2023

This causes Slint source code being retrieved every time a cmake configuration is triggered.

CMake Warning at CMakeLists.txt:4 (find_package):
[cmake] By not providing "FindSlint.cmake" in CMAKE_MODULE_PATH this project has
[cmake] asked CMake to find a package configuration file provided by "Slint", but
[cmake] CMake did not find one.
[cmake]
[cmake] Could not find a package configuration file provided by "Slint" with any of
[cmake] the following names:
[cmake]
[cmake] SlintConfig.cmake
[cmake] slint-config.cmake
[cmake]
[cmake] Add the installation prefix of "Slint" to CMAKE_PREFIX_PATH or set
[cmake] "Slint_DIR" to a directory containing one of the above files. If "Slint"
[cmake] provides a separate development package or SDK, be sure it has been
[cmake] installed.

@ogoffart
Copy link
Member

What version of cmake are you using?

The CMakeLists.txt line for is

find_package(Slint QUIET)

It contains a QUIET meaning you shouldn't get this warning

@Centaur
Copy link
Author

Centaur commented Oct 19, 2023

@ogoffart Yes. I removed QUIET to see what really happened. QUIET or not, the package is not found.

@ogoffart
Copy link
Member

Please copy your full CMakeLists then.
find_package only work if you have installed the slint library somehow and passed the paths to cmake.
if the package is not found, we call FetchContent_Declare/FetchContent_MakeAvailable instead. If that fails, do cmake show errors?

@Centaur
Copy link
Author

Centaur commented Oct 23, 2023

@ogoffart I know that is current behavior, but not neccessary a reasonable one.
I expect cmake should be smart enough to find slint after FetchContent_Declare/FetchContent_MakeAvailable/Slint build, instead of doing slint fetch/build everytime a cmake configuration is triggered.

@ogoffart
Copy link
Member

I'm afraid this is not how cmake work.
This would probably be a feature request for cmake.
Or if you find a way to make it work, please open a pull request.

tronical added a commit that referenced this issue Oct 23, 2023
…configure

Require CMake 2.4 to intregate CMake FetchContent and find_package,
according to https://cmake.org/cmake/help/latest/guide/using-dependencies/index.html#fetchcontent-and-find-package-integration

This way FetchContent_MakeAvailable will first try to call
find_package(Slint) and if that fails then fall back to building via
FetchContent.

Fixes #16
tronical added a commit that referenced this issue Oct 23, 2023
…configure

Require CMake 3.24 to intregate CMake FetchContent and find_package,
according to https://cmake.org/cmake/help/latest/guide/using-dependencies/index.html#fetchcontent-and-find-package-integration

This way FetchContent_MakeAvailable will first try to call
find_package(Slint) and if that fails then fall back to building via
FetchContent.

Fixes #16
@Centaur
Copy link
Author

Centaur commented Oct 26, 2023

My bad.
After set(FETCHCONTENT_QUIET OFF) I see what FetchContent actually does. It will not repeat the clone but just do update, and if nothing changes, Slint source code will not be built again. That is reasonable.
Please accept my apology.
Thank you for your patience.

@Centaur Centaur closed this as completed Oct 26, 2023
@tronical
Copy link
Member

No worries - all good. I'll also close the PR. The current approach isn't too bad and it works with older cmake versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants