Closed Apteryks closed 10 months ago
Hi!
Can you check the latest commit from 0.7-dev-0.7.2-issue-208 branch? It's necessary to specify -DRESTINIO_DEP_CATCH2=find
to the CMake configure (like here: https://github.com/Stiffstream/restinio-dockerfiles/blob/7b511213325091ad040b678bd2e0ea4ef18a714f/v0.7/archlinux-gcc-system-catch2.Dockerfile#L43-L44).
If it will work for you then I'll make a similar fix for #207.
Hi! It worked with -DRESTINIO_DEP_CATCH2=find
, but not with -DRESTINIO_DEP_CATCH2=system
. Perhaps it should, for uniformity with the other RESTINIODEP* options?
Thank you!
I'm afraid that -DRESTINIO_DEP_CATCH2=system
won't work because it's necessary to do include(Catch)
in the root CMakeLists.txt and it seems that include(Catch)
will work only after find_package(Catch2)
or add_subdirectory(catch2)
.
Is there a benefit to separating 'find' and 'system'? From my user perspective, I'm not sure what it means; I'm always interested in using system libraries; I guess three uses cases could be:
Is 'find' # 2 above?
The system
is for cases when a library is already installed in the system and there is no need to detect include/library paths.
The find
is for cases when a non-system package management is used (like vcpkg/conan or something similar).
The local
is for cases when something like git submodules, CMake's fetch_content or MxxRu::externals is used for managing dependencies.
Because sometimes CMake's find_package
can find a system-wide library, the find
option could be used for searching a library installed in the system.
The problem with Catch2 is that we need not only to find Catch2's header files and Catch2's .a/.lib files, but also use CMake's catch_discover_tests
command (for that purpose include(Catch)
is used in CMakeLists.txt).
Hi, and thanks for explaining. That's a very featureful library detection/fallback system! I guess -DRESTINIO_DEP_CATCH2=find
can be fine, although I suspect some users may stumble upon trying -DRESTINIO_DEP_CATCH2=system
.
Thank you!
The fix is now a part of v.0.7.2. Fill free to reopen the issue if something goes wrong for you.
Tested OK! Thank you.
Hello!
I'm glad restinio now uses a recent Catch2 (3.5.0) version, but it'd be even nicer if it allowed users to select a system-provided copy instead of relying on its bundled source.
I was able to use the system provided one using the following Guix substitution:
So not much is missing. the
find_package
call is necessary otherwise theinclude(Catch)
directive below fails.Cheers!