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()


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()
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D69194: build: ... Saleem Abdulrasool via Phabricator via cfe-commits

Reply via email to