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
if (NOT UUID_USING_CXX20_SPAN)
target_include_directories(${PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/gsl>
$<INSTALL_INTERFACE:include/gsl>)
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>)
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 ()
endif ()

View File

@ -16,7 +16,21 @@
#include <chrono>
#include <numeric>
#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>
#else
#include <gsl/gsl>
#endif
#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")
set_tests_properties("test_${PROJECT_NAME}"
PROPERTIES
TIMEOUT 120)
TIMEOUT 120)