Skip to content

Commit

Permalink
Add support for long paths on Windows for yarpidl_thrift
Browse files Browse the repository at this point in the history
  • Loading branch information
traversaro committed Nov 28, 2023
1 parent 76b9299 commit 581c266
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
25 changes: 25 additions & 0 deletions cmake/YarpInstallationHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -468,3 +468,28 @@ macro(YARP_INSTALL _what)
endif()

endmacro()


# yarp_enable_windows_longpath_support(<target>)
#
# This function enables longpath support on Windows on a given target by adding the appropriate
# manifest as documented in https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation .
#
# On non-Windows platforms, this functions does not do anything
function(YARP_ENABLE_WINDOWS_LONGPATH_SUPPORT _target)
if(MSVC)
set(yewls_manifest_filename "${_target}_longpath.manifest")
set(yewls_manifest_output "${CMAKE_CURRENT_BINARY_DIR}/${yewls_manifest_filename}")

set(yewls_manifest_contents [=[<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware>
</windowsSettings>
</application>
</assembly>]=])
file(GENERATE OUTPUT "${yewls_manifest_output}" CONTENT "${yewls_manifest_contents}")
target_sources(${_target} PRIVATE "${yewls_manifest_output}")
endif()
endfunction()
3 changes: 3 additions & 0 deletions doc/release/yarp_3_9/yarpidl_thrift_windows_longpath.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### `yarpidl_thrift`

* Add support for `yarpidl_thrift` to manipulate paths longer than 260 characters on Windows.
2 changes: 2 additions & 0 deletions src/yarpidl_thrift/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ target_sources(yarpidl_thrift
${yarpidl_thrift_YARP_SRCS}
)

yarp_enable_windows_longpath_support(yarpidl_thrift)

install(
TARGETS yarpidl_thrift
EXPORT YARP_idl_tools
Expand Down

0 comments on commit 581c266

Please sign in to comment.