diff options
author | Shoaib Meenai <smeenai@fb.com> | 2018-10-05 00:08:27 +0000 |
---|---|---|
committer | Shoaib Meenai <smeenai@fb.com> | 2018-10-05 00:08:27 +0000 |
commit | 7f46b39f865ccb550ce2bef893b95b7cca50032a (patch) | |
tree | 2df432bfd8092207e70f19fb7ac21f51649b3edf | |
parent | 49d5156384e15a9d98f3d96d0b3eafc170a19d69 (diff) |
[cmake] Also create lowercase extension WinSDK symlinks
Some projects rely on using libraries from the Windows SDK with their
original casing, just with a lowercase extension. E.g. the WinSock2 lib
is named WS2_32.Lib in the Windows SDK, and we would previously only
create a ws2_32.lib symlink for it (i.e. all lowercase). Also create a
WS2_32.lib symlink (i.e. original casing with lowercase extension) to
cover users of this casing. As a drive-by fix, only create these
symlinks when they differ from the original name to reduce the amount of
noise in the library symlinks directory.
-rw-r--r-- | llvm/cmake/platforms/WinMsvc.cmake | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/llvm/cmake/platforms/WinMsvc.cmake b/llvm/cmake/platforms/WinMsvc.cmake index a736a457872..f625d0e3c05 100644 --- a/llvm/cmake/platforms/WinMsvc.cmake +++ b/llvm/cmake/platforms/WinMsvc.cmake @@ -136,11 +136,25 @@ function(generate_winsdk_lib_symlinks winsdk_um_lib_dir output_dir) execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory "${output_dir}") file(GLOB libraries RELATIVE "${winsdk_um_lib_dir}" "${winsdk_um_lib_dir}/*") foreach(library ${libraries}) - string(TOLOWER "${library}" symlink_name) - execute_process(COMMAND "${CMAKE_COMMAND}" - -E create_symlink - "${winsdk_um_lib_dir}/${library}" - "${output_dir}/${symlink_name}") + string(TOLOWER "${library}" all_lowercase_symlink_name) + if(NOT library STREQUAL all_lowercase_symlink_name) + execute_process(COMMAND "${CMAKE_COMMAND}" + -E create_symlink + "${winsdk_um_lib_dir}/${library}" + "${output_dir}/${all_lowercase_symlink_name}") + endif() + + get_filename_component(name_we "${library}" NAME_WE) + get_filename_component(ext "${library}" EXT) + string(TOLOWER "${ext}" lowercase_ext) + set(lowercase_ext_symlink_name "${name_we}${lowercase_ext}") + if(NOT library STREQUAL lowercase_ext_symlink_name AND + NOT all_lowercase_symlink_name STREQUAL lowercase_ext_symlink_name) + execute_process(COMMAND "${CMAKE_COMMAND}" + -E create_symlink + "${winsdk_um_lib_dir}/${library}" + "${output_dir}/${lowercase_ext_symlink_name}") + endif() endforeach() endfunction() |