diff --git a/.gitignore b/.gitignore index fd4e108..e275b70 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ build /test/CMakeFiles/3.10.0/CompilerIdC/Debug/CompilerIdC.tlog +/.vs diff --git a/CMakeLists.txt b/CMakeLists.txt index f899b86..3759b18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,20 +8,24 @@ file(GLOB headers ${CMAKE_SOURCE_DIR}/include/*.h) file(GLOB SOURCES "test/*.cpp" "include/*.cpp") if(BUILD_TESTS) - include(CTest) + include(CTest) +endif() + +if(UUID_SYSTEM_GENERATOR) + add_definitions(-DUUID_SYSTEM_GENERATOR) endif() if(WIN32) message(status "Setting MSVC flags") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHc /std:c++latest") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHc /std:c++17") add_definitions(-D_SCL_SECURE_NO_WARNINGS) elseif(APPLE) message(status "Setting Clang flags") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1z -fexceptions -g -Wall") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -fexceptions -g -Wall") else() #include_directories(${LIBUUID_INCLUDE_DIR}) message(status "Setting GCC flags") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1z -fexceptions -g -Wall") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -fexceptions -g -Wall") endif() add_executable(test_uuid ${SOURCES} ${headers}) diff --git a/include/uuid.h b/include/uuid.h index a99a43f..1aaf651 100644 --- a/include/uuid.h +++ b/include/uuid.h @@ -24,18 +24,30 @@ #ifndef NOMINMAX #define NOMINMAX #endif + +#ifdef UUID_SYSTEM_GENERATOR #include +#endif + #include #include #include #pragma comment(lib, "IPHLPAPI.lib") #elif defined(__linux__) || defined(__unix__) + +#ifdef UUID_SYSTEM_GENERATOR #include +#endif + #elif defined(__APPLE__) + +#ifdef UUID_SYSTEM_GENERATOR #include #endif +#endif + namespace uuids { namespace detail @@ -611,6 +623,7 @@ namespace uuids // uuid generators // -------------------------------------------------------------------------------------------------------------------------- +#ifdef UUID_SYSTEM_GENERATOR class uuid_system_generator { public: @@ -705,6 +718,7 @@ namespace uuids #endif } }; +#endif template class basic_uuid_random_generator