vcpkg/ports/fastrtps/fix-xtime.patch

24 lines
1.2 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7ca47ae..632c38b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,6 +42,18 @@ message(STATUS "Version: ${PROJECT_VERSION}")
###############################################################################
option(EPROSIMA_BUILD "Activate internal building" OFF)
+###############################################################################
+# Replace xtime with _timespec64. As a workround of the unreleased version of
+# MSVC, it will be deleted after release.
+###############################################################################
+if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
+ if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "19.37.32705.0")
+ file(READ "${PROJECT_SOURCE_DIR}/include/fastrtps/utils/TimedMutex.hpp" _contents)
+ string(REPLACE "xtime*" "_timespec64*" _contents "${_contents}")
+ file(WRITE "${PROJECT_SOURCE_DIR}/include/fastrtps/utils/TimedMutex.hpp" "${_contents}")
+ endif()
+endif()
+
###############################################################################
# Warning level
###############################################################################