Merge pull request #67 from chaorunrun/compile-for-c++17

Fix errors on compilation with c++17
This commit is contained in:
Marius Bancila 2022-06-16 12:21:45 +03:00 committed by GitHub
commit 3afe7193fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 7 deletions

View File

@ -45,11 +45,9 @@ 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>)
if(UUID_ENABLE_INSTALL)
install(DIRECTORY gsl DESTINATION include)
endif()
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>)
install(DIRECTORY gsl DESTINATION include)
endif ()
if(UUID_ENABLE_INSTALL)
@ -81,4 +79,4 @@ endif()
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/span>
#endif
#ifdef _WIN32
@ -950,4 +964,4 @@ namespace std
};
}
#endif /* STDUUID_H */
#endif /* STDUUID_H */