From 27161be68648f9056342c4c34aaa75dc8100ab5d Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Thu, 5 Jan 2023 00:09:15 +0700 Subject: [PATCH 1/3] Fix catch2 includes --- tests/function_test.cpp | 2 +- tests/main.cpp | 2 +- tests/optional_test.cpp | 2 +- tests/sequence_container_test.cpp | 2 +- tests/variant_test.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/function_test.cpp b/tests/function_test.cpp index 4078766..9d46f2d 100644 --- a/tests/function_test.cpp +++ b/tests/function_test.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/tests/main.cpp b/tests/main.cpp index f481b16..13928b9 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -1,3 +1,3 @@ #define CATCH_CONFIG_MAIN -#include +#include diff --git a/tests/optional_test.cpp b/tests/optional_test.cpp index 54dff11..5ccd5dd 100644 --- a/tests/optional_test.cpp +++ b/tests/optional_test.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/tests/sequence_container_test.cpp b/tests/sequence_container_test.cpp index 3c173f3..c0ac823 100644 --- a/tests/sequence_container_test.cpp +++ b/tests/sequence_container_test.cpp @@ -1,4 +1,4 @@ -#include +#include #include "utils.h" #include diff --git a/tests/variant_test.cpp b/tests/variant_test.cpp index 9c9ee18..4e7e626 100644 --- a/tests/variant_test.cpp +++ b/tests/variant_test.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include From e70e8a62b28e2c79cc7229f4b3daa464c61b5814 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Thu, 5 Jan 2023 00:12:48 +0700 Subject: [PATCH 2/3] Fix for missing _main on macOS --- tests/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/main.cpp b/tests/main.cpp index 13928b9..2bd3007 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -1,3 +1,5 @@ #define CATCH_CONFIG_MAIN #include + +int main() { return 0; } From 11d0a509f4f16fa4b5a99dc988a37ba60de43e57 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Thu, 5 Jan 2023 00:16:26 +0700 Subject: [PATCH 3/3] tests/CMakeLists.txt: use C++17 --- tests/CMakeLists.txt | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b788444..45ba1ba 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -10,8 +10,23 @@ add_executable(${PROJECT_NAME} variant_test.cpp ) -if (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU|Clang") +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") + target_compile_options(${PROJECT_NAME} + PRIVATE + -std=gnu++17 + ) +else() target_compile_options(${PROJECT_NAME} + PRIVATE + -std=c++17 + ) +endif() + +if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") + add_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror -ansi -pedantic )