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 f610ec1
Show file tree
Hide file tree
Showing 2 changed files with 27 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()
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 f610ec1

Please sign in to comment.