Skip to content

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

@yurivict

Description

@yurivict

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions