Unknown CMake command "catch_discover_tests".
About9 opened this issue ยท 6 comments
About9 commented
-- Detected CPPZMQ Version - 4.3.1
-- cppzmq v4.3.1
CMake Error at tests/CMakeLists.txt:47 (catch_discover_tests):
Unknown CMake command "catch_discover_tests".
where I ran 'cmake ..', this error shows. The following issue says libzmq3-dev should make it. But what is libzmq3-dev? How can I install it?
anantmurti commented
I am facing the same issue since couple days and with no real solution until now. Were you able to solve it ?
t-b commented
Maybe something like
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 5c91ac4..cae89b3 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -45,4 +45,8 @@ if (COVERAGE)
target_link_libraries(unit_tests PRIVATE --coverage)
endif()
-catch_discover_tests(unit_tests)
+find_package(Catch QUIET)
+
+if(Catch_FOUND)
+ catch_discover_tests(unit_tests)
+endif()
would help?
dionisioedu commented
The easy solution is to use -DCPPZMQ_BUILD_TESTS=OFF on cmake. Like that:
cmake -DCPPZMQ_BUILD_TESTS=OFF ..
Worked fine for me.
SylvainCorlay commented
Same issue here.
TBK commented
I fixed it by applying these changes:
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -9,11 +9,14 @@
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
+find_package(Threads)
+find_package(Catch2 REQUIRED)
+
include(CTest)
+include(Catch)
include(cmake/catch.cmake)
include(${CATCH_MODULE_PATH}/Catch.cmake)
-find_package(Threads)
add_executable(
unit_tests
@@ -38,6 +41,7 @@
target_link_libraries(
unit_tests
PRIVATE cppzmq
+ PRIVATE Catch2::Catch2
PRIVATE ${CMAKE_THREAD_LIBS_INIT}
)
based upon https://github.com/catchorg/Catch2/blob/devel/docs/cmake-integration.md#usage