vcpkg/ports/fastrtps/fix-xtime.patch
MonicaLiu 809266d51a
[fastrtps] Replace xtime with _timespec64 for fixing error C2065 (#30823)
* fix xtime*

* update version

* update patch

* update version

---------

Co-authored-by: Monica <v-liumonica@microsoft.com>
2023-04-13 21:48:43 -07:00

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.36.32528.95")
+ 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
###############################################################################