I don’t know anything about MacOS command lines, so hopefully someone else can comment on this <br><div class="gmail_quote"><div dir="ltr">On Wed, Dec 13, 2017 at 6:57 PM Shoaib Meenai via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">smeenai created this revision.<br>
smeenai added reviewers: compnerd, rnk, zturner.<br>
Herald added a subscriber: mgorny.<br>
<br>
macOS paths usually start with /Users, which clang-cl interprets as a<br>
macro undefine, leading to pretty much everything failing to compile.<br>
<br>
CMake should be taught to put a -- in its compilation rules for clang-cl<br>
(and I've been meaning to submit that upstream for a while). In the<br>
meantime, however, and to support older CMake versions, we can just<br>
create a custom make rules override to fix the compilation rules.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D41219" rel="noreferrer" target="_blank">https://reviews.llvm.org/D41219</a><br>
<br>
Files:<br>
  cmake/platforms/ClangClCMakeCompileRules.cmake<br>
  cmake/platforms/WinMsvc.cmake<br>
<br>
<br>
Index: cmake/platforms/WinMsvc.cmake<br>
===================================================================<br>
--- cmake/platforms/WinMsvc.cmake<br>
+++ cmake/platforms/WinMsvc.cmake<br>
@@ -306,3 +306,5 @@<br>
 # resulting warnings about missing libraries.<br>
 set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)<br>
<br>
+# Allow clang-cl to work with macOS paths.<br>
+set(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_CURRENT_LIST_DIR}/ClangClCMakeCompileRules.cmake")<br>
Index: cmake/platforms/ClangClCMakeCompileRules.cmake<br>
===================================================================<br>
--- /dev/null<br>
+++ cmake/platforms/ClangClCMakeCompileRules.cmake<br>
@@ -0,0 +1,9 @@<br>
+# macOS paths usually start with /Users/*. Unfortunately, clang-cl interprets<br>
+# paths starting with /U as macro undefines, so we need to put a -- before the<br>
+# input file path to force it to be treated as a path. CMake's compilation rules<br>
+# should be tweaked accordingly, but until that's done, and to support older<br>
+# CMake versions, overriding compilation rules works well enough. This file will<br>
+# be included by cmake after the default compilation rules have already been set<br>
+# up, so we can just modify them instead of duplicating them entirely.<br>
+string(REPLACE "-c <SOURCE>" "-c -- <SOURCE>" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}")<br>
+string(REPLACE "-c <SOURCE>" "-c -- <SOURCE>" CMAKE_CXX_COMPILE_OBJECT "${CMAKE_CXX_COMPILE_OBJECT}")<br>
<br>
<br>
</blockquote></div>