Fix errors on compilation with c++17

This commit is contained in:
Adam Jiang 2022-05-18 21:51:45 +08:00
parent db4963048d
commit 979ba59e41
3 changed files with 19 additions and 5 deletions

View File

@ -38,8 +38,8 @@ endif()
# Using span from std # Using span from std
if (NOT UUID_USING_CXX20_SPAN) if (NOT UUID_USING_CXX20_SPAN)
target_include_directories(${PROJECT_NAME} INTERFACE target_include_directories(${PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/gsl> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include/gsl>) $<INSTALL_INTERFACE:include>)
install(DIRECTORY gsl DESTINATION include) install(DIRECTORY gsl DESTINATION include)
endif () endif ()
@ -70,4 +70,4 @@ export(EXPORT ${PROJECT_NAME}-targets
if (UUID_BUILD_TESTS) if (UUID_BUILD_TESTS)
enable_testing() enable_testing()
add_subdirectory(test) add_subdirectory(test)
endif () endif ()

View File

@ -16,7 +16,21 @@
#include <chrono> #include <chrono>
#include <numeric> #include <numeric>
#include <atomic> #include <atomic>
#ifdef __cplusplus
# if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L)
# define LIBUUID_CPP20_OR_GREATER
# endif
#endif
#ifdef LIBUUID_CPP20_OR_GREATER
#include <span> #include <span>
#else
#include <gsl/gsl>
#endif
#ifdef _WIN32 #ifdef _WIN32
@ -950,4 +964,4 @@ namespace std
}; };
} }
#endif /* STDUUID_H */ #endif /* STDUUID_H */

View File

@ -28,4 +28,4 @@ set_tests_properties("test_${PROJECT_NAME}"
FAIL_REGULAR_EXPRESSION "Failed \\d+ test cases") FAIL_REGULAR_EXPRESSION "Failed \\d+ test cases")
set_tests_properties("test_${PROJECT_NAME}" set_tests_properties("test_${PROJECT_NAME}"
PROPERTIES PROPERTIES
TIMEOUT 120) TIMEOUT 120)