From 979ba59e41670b33ddbc5684fbc5e36048e80303 Mon Sep 17 00:00:00 2001 From: Adam Jiang Date: Wed, 18 May 2022 21:51:45 +0800 Subject: [PATCH 1/2] Fix errors on compilation with c++17 --- CMakeLists.txt | 6 +++--- include/uuid.h | 16 +++++++++++++++- test/CMakeLists.txt | 2 +- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fffb92c..b80668d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,8 +38,8 @@ endif() # Using span from std if (NOT UUID_USING_CXX20_SPAN) target_include_directories(${PROJECT_NAME} INTERFACE - $ - $) + $ + $) install(DIRECTORY gsl DESTINATION include) endif () @@ -70,4 +70,4 @@ export(EXPORT ${PROJECT_NAME}-targets if (UUID_BUILD_TESTS) enable_testing() add_subdirectory(test) -endif () \ No newline at end of file +endif () diff --git a/include/uuid.h b/include/uuid.h index b75c9b5..af2d8c5 100644 --- a/include/uuid.h +++ b/include/uuid.h @@ -16,7 +16,21 @@ #include #include #include + +#ifdef __cplusplus + +# if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) +# define LIBUUID_CPP20_OR_GREATER +# endif + +#endif + + +#ifdef LIBUUID_CPP20_OR_GREATER #include +#else +#include +#endif #ifdef _WIN32 @@ -950,4 +964,4 @@ namespace std }; } -#endif /* STDUUID_H */ \ No newline at end of file +#endif /* STDUUID_H */ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index cefe4af..eb3b0b3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -28,4 +28,4 @@ set_tests_properties("test_${PROJECT_NAME}" FAIL_REGULAR_EXPRESSION "Failed \\d+ test cases") set_tests_properties("test_${PROJECT_NAME}" PROPERTIES - TIMEOUT 120) \ No newline at end of file + TIMEOUT 120) From e5da05d8def8da23380c15c8da80406690c8aff3 Mon Sep 17 00:00:00 2001 From: Adam Jiang Date: Wed, 25 May 2022 09:47:48 +0800 Subject: [PATCH 2/2] Use --- include/uuid.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/uuid.h b/include/uuid.h index af2d8c5..d48059d 100644 --- a/include/uuid.h +++ b/include/uuid.h @@ -29,7 +29,7 @@ #ifdef LIBUUID_CPP20_OR_GREATER #include #else -#include +#include #endif #ifdef _WIN32