mirror of
https://github.com/fpagliughi/sockpp.git
synced 2026-01-12 00:04:45 +08:00
Merge pull request #84 from kotopesutility/develop
Fixed building for catch2 (>=3.0)
This commit is contained in:
@@ -39,6 +39,11 @@
|
||||
set(UNIT_TEST_DIR ${PROJECT_SOURCE_DIR})
|
||||
find_package(Catch2 REQUIRED)
|
||||
|
||||
if (Catch2_VERSION VERSION_LESS "3.0")
|
||||
add_definitions(-DCATCH2_V2)
|
||||
message(WARNING "catch2 version is less than in upstream")
|
||||
endif()
|
||||
|
||||
# --- For apps that use threads ---
|
||||
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
@@ -80,6 +85,7 @@ target_include_directories(unit_tests
|
||||
${SOCKPP_INCLUDE_DIR}
|
||||
PRIVATE
|
||||
${SOCKPP_GENERATED_DIR}/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
set_target_properties(unit_tests PROPERTIES
|
||||
|
||||
5
tests/unit/catch2_version.h
Normal file
5
tests/unit/catch2_version.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#ifdef CATCH2_V2
|
||||
#include "catch2/catch.hpp"
|
||||
#else
|
||||
#include "catch2/catch_all.hpp"
|
||||
#endif
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
#include "sockpp/acceptor.h"
|
||||
#include "sockpp/inet_address.h"
|
||||
#include "catch2/catch.hpp"
|
||||
#include <catch2_version.h>
|
||||
#include <string>
|
||||
|
||||
using namespace sockpp;
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
//
|
||||
|
||||
#include "sockpp/can_address.h"
|
||||
#include "catch2/catch.hpp"
|
||||
#include <catch2_version.h>
|
||||
#include <string>
|
||||
|
||||
using namespace sockpp;
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
#include "sockpp/connector.h"
|
||||
#include "sockpp/sock_address.h"
|
||||
#include "catch2/catch.hpp"
|
||||
#include <catch2_version.h>
|
||||
#include <string>
|
||||
|
||||
using namespace sockpp;
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
#include "sockpp/datagram_socket.h"
|
||||
#include "sockpp/inet_address.h"
|
||||
#include "catch2/catch.hpp"
|
||||
#include <catch2_version.h>
|
||||
#include <string>
|
||||
|
||||
using namespace sockpp;
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
//
|
||||
|
||||
#include "sockpp/inet6_address.h"
|
||||
#include "catch2/catch.hpp"
|
||||
#include <catch2_version.h>
|
||||
#include <string>
|
||||
|
||||
using namespace sockpp;
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
//
|
||||
|
||||
#include "sockpp/inet_address.h"
|
||||
#include "catch2/catch.hpp"
|
||||
#include <catch2_version.h>
|
||||
#include <string>
|
||||
|
||||
using namespace sockpp;
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
//
|
||||
|
||||
#include "sockpp/result.h"
|
||||
#include "catch2/catch.hpp"
|
||||
#include <catch2_version.h>
|
||||
|
||||
using namespace sockpp;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
#include "sockpp/socket.h"
|
||||
#include "sockpp/inet_address.h"
|
||||
#include "catch2/catch.hpp"
|
||||
#include <catch2_version.h>
|
||||
#include <string>
|
||||
|
||||
using namespace sockpp;
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
#include "sockpp/stream_socket.h"
|
||||
#include "sockpp/inet_address.h"
|
||||
#include "catch2/catch.hpp"
|
||||
#include <catch2_version.h>
|
||||
#include <string>
|
||||
|
||||
using namespace sockpp;
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#include "sockpp/tcp_socket.h"
|
||||
#include "sockpp/tcp_connector.h"
|
||||
#include "sockpp/tcp_acceptor.h"
|
||||
#include "catch2/catch.hpp"
|
||||
#include <catch2_version.h>
|
||||
#include <string>
|
||||
|
||||
using namespace sockpp;
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
//
|
||||
|
||||
#include "sockpp/unix_address.h"
|
||||
#include "catch2/catch.hpp"
|
||||
#include <catch2_version.h>
|
||||
#include <string>
|
||||
|
||||
using namespace sockpp;
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
//
|
||||
|
||||
#include "sockpp/unix_dgram_socket.h"
|
||||
#include "catch2/catch.hpp"
|
||||
#include <catch2_version.h>
|
||||
#include <string>
|
||||
|
||||
using namespace sockpp;
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
//
|
||||
|
||||
#include "sockpp/unix_stream_socket.h"
|
||||
#include "catch2/catch.hpp"
|
||||
#include <catch2_version.h>
|
||||
#include <string>
|
||||
|
||||
using namespace sockpp;
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
#endif
|
||||
|
||||
#define CATCH_CONFIG_RUNNER
|
||||
#include "catch2/catch.hpp"
|
||||
#include <catch2_version.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user