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

Fails to find system Catch2: include could not find requested file: Catch #218

Open
yurivict opened this issue May 5, 2024 · 1 comment

Comments

@yurivict
Copy link

yurivict commented May 5, 2024

When cmake arguments include -DRESTINIO_DEP_CATCH2=system, configure fails:

CMake Error at CMakeLists.txt:350 (include):
  include could not find requested file:

    Catch


CMake Error at cmake/unittest.cmake:25 (catch_discover_tests):
  Unknown CMake command "catch_discover_tests".
Call Stack (most recent call first):
  test/metaprogramming/CMakeLists.txt:2 (include)

find_package(Catch2 REQUIRED) is missing.

The problem goes away with this patch that adds find_package in general:

--- CMakeLists.txt.orig 2024-02-02 12:28:15 UTC
+++ CMakeLists.txt
@@ -347,6 +347,7 @@ if (RESTINIO_TEST)
         message("========================================")
     endif ()
 
+    find_package(Catch2 REQUIRED)
     include(Catch)
 
     enable_testing()

This should be done only when RESTINIO_DEP_CATCH2=system.

Version 0.7.2
FreeBSD 14.0
catch2-3.5.4

@eao197
Copy link
Member

eao197 commented May 6, 2024

Hi!

If I understand correctly, you've installed Catch2 via FreeBSD's package manager and the have tried to configure RESTinio with -DRESTINIO_DEP_CATCH2=system. Am I right?

The idea behind system, local and find was as simple as following:

  • if source code of dep X (like Catch2) is in source tree, then local has to be used;
  • if source code of dep X isn't in source tree, but CMake's find_package works and finds the X, then find has to be used;
  • otherwise the X is installed somewhere in the system and is available for compiler/linker (for example, via standard include/lib paths or via INCLUDE/LIB environment variables), then system has to be used as the last option.

So, if Catch2 installed via FreeBSD's package manager and is available via CMake's find_package then find should be used as the value for RESTINIO_DEP_CATCH2.

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

No branches or pull requests

2 participants