[PATCH] D69194: build: add clang-cl and clang++ symlinks in the build tree

Saleem Abdulrasool via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 18 14:04:47 PDT 2019


compnerd created this revision.
compnerd added reviewers: xiaobai, beanz, smeenai.
Herald added a subscriber: mgorny.
Herald added a project: clang.

This adds the clang-cl and clang++ symlinks.  Since there are no targets to depend on for this, we cannot force the creation of the symlinks.  Furthermore, the current build only installs the symbolic links in the install tree, not the build tree.  This enables the use of the clang driver without having adjust the C/C++ flags to add `--driver=...` to switch between driver modes.  Usage of this is present in Swift and there is some usage in lldb.


Repository:
  rC Clang

https://reviews.llvm.org/D69194

Files:
  tools/driver/CMakeLists.txt


Index: tools/driver/CMakeLists.txt
===================================================================
--- tools/driver/CMakeLists.txt
+++ tools/driver/CMakeLists.txt
@@ -49,6 +49,15 @@
   clangSerialization
   )
 
+if(CMAKE_VERSION VERSION_GREATER 3.7 OR NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
+  set(command create_symlink)
+else()
+  set(command copy)
+endif()
+add_custom_command(TARGET clang POST_BUILD
+  COMMAND ${CMAKE_COMMAND} -E ${command} $<TARGET_FILE:clang> $<TARGET_FILE_DIR:clang>/clang-cl${CMAKE_EXECUTABLE_SUFFIX}
+  COMMAND ${CMAKE_COMMAND} -E ${command} $<TARGET_FILE:clang> $<TARGET_FILE_DIR:clang>/clang++${CMAKE_EXECUTABLE_SUFFIX})
+
 if(WIN32 AND NOT CYGWIN)
   # Prevent versioning if the buildhost is targeting for Win32.
 else()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69194.225690.patch
Type: text/x-patch
Size: 756 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191018/cec560a2/attachment.bin>


More information about the cfe-commits mailing list