Skip to content

Commit

Permalink
Merge pull request mariusbancila#67 from chaorunrun/compile-for-c++17
Browse files Browse the repository at this point in the history
Fix errors on compilation with c++17
  • Loading branch information
mariusbancila authored Jun 16, 2022
2 parents 3dca9d8 + e5da05d commit 3afe719
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
10 changes: 4 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -81,4 +79,4 @@ endif()
if (UUID_BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif ()
endif ()
16 changes: 15 additions & 1 deletion include/uuid.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -950,4 +964,4 @@ namespace std
};
}

#endif /* STDUUID_H */
#endif /* STDUUID_H */

0 comments on commit 3afe719

Please sign in to comment.