diff --git a/depends/catch2/CMakeLists.txt b/depends/catch2/CMakeLists.txt new file mode 100644 index 00000000000000..8fdfcf0189e8da --- /dev/null +++ b/depends/catch2/CMakeLists.txt @@ -0,0 +1,33 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 3.14.0 FATAL_ERROR) + +set(PROJECT_NAME "catch2") + +project( + ${PROJECT_NAME} + VERSION 2.13 + LANGUAGES CXX +) + + +set( + ${PROJECT_NAME}_HEADERS + catch2/catch.hpp +) + +list( + TRANSFORM ${PROJECT_NAME}_HEADERS + PREPEND "${CMAKE_CURRENT_LIST_DIR}/include/" +) + +add_library( + ${PROJECT_NAME} + INTERFACE + "${${PROJECT_NAME}_HEADERS}" +) + +target_include_directories( + ${PROJECT_NAME} + INTERFACE + "$" + "$" +) diff --git a/contrib/catch/catch.hpp b/depends/catch2/include/catch2/catch.hpp similarity index 100% rename from contrib/catch/catch.hpp rename to depends/catch2/include/catch2/catch.hpp diff --git a/python-bindings/CMakeLists.txt b/python-bindings/CMakeLists.txt index 6bba03b4091ef1..e527afaa462956 100644 --- a/python-bindings/CMakeLists.txt +++ b/python-bindings/CMakeLists.txt @@ -2,7 +2,7 @@ FetchContent_Declare( pybind11 GIT_REPOSITORY https://github.com/pybind/pybind11.git - GIT_TAG v2.6.2 + GIT_TAG v2.9.1 ) FetchContent_MakeAvailable(pybind11 relic) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index df56c573379f4f..09744ca68345a0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -39,21 +39,12 @@ install(FILES ${HEADERS} DESTINATION include/bls-dash) install(FILES $ DESTINATION lib) if(BUILD_BLS_TESTS) + include(${CMAKE_CURRENT_SOURCE_DIR}/../depends/catch2/CMakeLists.txt) + add_executable(runtest test.cpp) - INCLUDE(FindPkgConfig) - pkg_check_modules(CATCH2 catch2) - if (CATCH2_FOUND) - # Adding "catch2" subdir to include dirs because "catch.hpp" is included - # instead of "catch2/catch.hpp" - if (NOT CATCH2_INCLUDE_DIRS) - set(CATCH2_INCLUDE_DIRS ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}) - endif() - list(TRANSFORM CATCH2_INCLUDE_DIRS APPEND /catch2) - target_include_directories(runtest PRIVATE ${CATCH2_INCLUDE_DIRS}) - else() - target_include_directories(runtest PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../contrib/catch) - endif() - target_link_libraries(runtest PRIVATE bls-dash) + target_link_libraries(runtest + PRIVATE bls-dash + PRIVATE catch2) endif() if(BUILD_BLS_BENCHMARKS) diff --git a/src/test.cpp b/src/test.cpp index 1ec7eef812cd76..5875f22ff3c3b2 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -17,7 +17,8 @@ #include #include "bls.hpp" -#include "catch.hpp" +#include + extern "C" { #include "relic.h" }