enum DriverMode {
GCCMode,
GXXMode,
- CPPMode
+ CPPMode,
+ CLMode
} Mode;
public:
.Case("gcc", GCCMode)
.Case("g++", GXXMode)
.Case("cpp", CPPMode)
+ .Case("cl", CLMode)
.Default(~0U);
if (M != ~0U)
--- /dev/null
+// RUN: %clang_cl -fsyntax-only -c %s
+
+void f();
getClangBuiltinIncludeDir(config.clang))) )
config.substitutions.append( ('%clang_cpp', ' ' + config.clang +
' --driver-mode=cpp '))
-
+config.substitutions.append( ('%clang_cl', ' ' + config.clang +
+ ' --driver-mode=cl '))
config.substitutions.append( ('%clangxx', ' ' + config.clang +
' --driver-mode=g++ '))
config.substitutions.append( ('%clang', ' ' + config.clang + ' ') )
config.substitutions.append(
(' %clang-cpp ',
"""*** invalid substitution, use '%clang_cpp'. ***""") )
+config.substitutions.append(
+ (' %clang-cl ',
+ """*** invalid substitution, use '%clang_cl'. ***""") )
###
set_property(DIRECTORY APPEND
PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${clang_pp})
+# Create the clang-cl symlink in the build directory.
+set(clang_cl "${LLVM_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/clang-cl${CMAKE_EXECUTABLE_SUFFIX}")
+add_custom_command(TARGET clang POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E ${CLANGXX_LINK_OR_COPY} "${clang_binary}" "${clang_cl}")
+
+set_property(DIRECTORY APPEND
+ PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${clang_cl})
+
install(TARGETS clang
RUNTIME DESTINATION bin)
-# Create the clang++ symlink at installation time.
+# Create the clang++ and clang-cl symlinks at installation time.
install(SCRIPT clang_symlink.cmake -DCMAKE_INSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\")
set(bindir "${CLANGXX_DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/")
set(clang "clang${EXECUTABLE_SUFFIX}")
set(clangxx "clang++${EXECUTABLE_SUFFIX}")
+set(clang_cl "clang-cl${EXECUTABLE_SUFFIX}")
message("Creating clang++ executable based on ${clang}")
execute_process(
COMMAND "${CMAKE_COMMAND}" -E ${CLANGXX_LINK_OR_COPY} "${clang}" "${clangxx}"
WORKING_DIRECTORY "${bindir}")
+
+message("Creating clang-cl executable based on ${clang}")
+
+execute_process(
+ COMMAND "${CMAKE_COMMAND}" -E ${CLANGXX_LINK_OR_COPY} "${clang}" "${clang_cl}"
+ WORKING_DIRECTORY "${bindir}")
{ "clang-cpp", "--driver-mode=cpp" },
{ "clang-g++", "--driver-mode=g++" },
{ "clang-gcc", 0 },
+ { "clang-cl", "--driver-mode=cl" },
{ "cc", 0 },
{ "cpp", "--driver-mode=cpp" },
+ { "cl" , "--driver-mode=cl" },
{ "++", "--driver-mode=g++" },
};
std::string ProgName(llvm::sys::path::stem(ArgVector[0]));