[llvm] r343832 - [cmake] Also create lowercase extension WinSDK symlinks

Shoaib Meenai via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 4 17:08:28 PDT 2018


Author: smeenai
Date: Thu Oct  4 17:08:27 2018
New Revision: 343832

URL: http://llvm.org/viewvc/llvm-project?rev=343832&view=rev
Log:
[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.

Modified:
    llvm/trunk/cmake/platforms/WinMsvc.cmake

Modified: llvm/trunk/cmake/platforms/WinMsvc.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/platforms/WinMsvc.cmake?rev=343832&r1=343831&r2=343832&view=diff
==============================================================================
--- llvm/trunk/cmake/platforms/WinMsvc.cmake (original)
+++ llvm/trunk/cmake/platforms/WinMsvc.cmake Thu Oct  4 17:08:27 2018
@@ -136,11 +136,25 @@ function(generate_winsdk_lib_symlinks wi
   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()
 




More information about the llvm-commits mailing list