Skip to content

Commit a5d360b

Browse files
committed
build: do not create WinSDK symlinks when unneeded
When building on case insensitive filesystems, there is no need to create the library symlink forest as the paths will be resolved properly due to the insensitivity. This avoids a bit of work and spew on Windows.
1 parent c044001 commit a5d360b

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

cmake/modules/SwiftConfigureSDK.cmake

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -277,19 +277,21 @@ macro(configure_sdk_windows name environment architectures)
277277
set(WinSDK${arch}UMDir "$ENV{UniversalCRTSdkDir}/Lib/$ENV{UCRTVersion}/um/${WinSDKArchitecture}")
278278
set(OverlayDirectory "${CMAKE_BINARY_DIR}/winsdk_lib_${arch}_symlinks")
279279

280-
file(MAKE_DIRECTORY ${OverlayDirectory})
281-
282-
file(GLOB libraries RELATIVE "${WinSDK${arch}UMDir}" "${WinSDK${arch}UMDir}/*")
283-
foreach(library ${libraries})
284-
get_filename_component(name_we "${library}" NAME_WE)
285-
get_filename_component(ext "${library}" EXT)
286-
string(TOLOWER "${ext}" lowercase_ext)
287-
set(lowercase_ext_symlink_name "${name_we}${lowercase_ext}")
288-
if(NOT library STREQUAL lowercase_ext_symlink_name)
289-
execute_process(COMMAND
290-
"${CMAKE_COMMAND}" -E create_symlink "${WinSDK${arch}UMDir}/${library}" "${OverlayDirectory}/${lowercase_ext_symlink_name}")
291-
endif()
292-
endforeach()
280+
if(NOT EXISTS "$ENV{UniversalCRTSdkDir}/Include/$ENV{UCRTVersion}/um/WINDOWS.H")
281+
file(MAKE_DIRECTORY ${OverlayDirectory})
282+
283+
file(GLOB libraries RELATIVE "${WinSDK${arch}UMDir}" "${WinSDK${arch}UMDir}/*")
284+
foreach(library ${libraries})
285+
get_filename_component(name_we "${library}" NAME_WE)
286+
get_filename_component(ext "${library}" EXT)
287+
string(TOLOWER "${ext}" lowercase_ext)
288+
set(lowercase_ext_symlink_name "${name_we}${lowercase_ext}")
289+
if(NOT library STREQUAL lowercase_ext_symlink_name)
290+
execute_process(COMMAND
291+
"${CMAKE_COMMAND}" -E create_symlink "${WinSDK${arch}UMDir}/${library}" "${OverlayDirectory}/${lowercase_ext_symlink_name}")
292+
endif()
293+
endforeach()
294+
endif()
293295
endforeach()
294296

295297
# Add this to the list of known SDKs.

0 commit comments

Comments
 (0)