summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-08-10 15:33:00 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-08-10 15:33:19 (GMT)
commit0953c0051edcf3d4fb103b864fc0a7068dfedf59 (patch)
tree551dea245e9dcc46f078909fa5b5666b7a4e4e9c /Source
parentc65f6a524e3a782877e6747194a92dbf85184999 (diff)
parent20ebaed97235d8397638807ff791803f8bd4e215 (diff)
downloadCMake-0953c0051edcf3d4fb103b864fc0a7068dfedf59.zip
CMake-0953c0051edcf3d4fb103b864fc0a7068dfedf59.tar.gz
CMake-0953c0051edcf3d4fb103b864fc0a7068dfedf59.tar.bz2
Merge topic 'clang-cl-vfs'
20ebaed972 Clang: Add support for passing VFS arguments d993ebd4ca clang-cl: Add '--' before source file a94672b919 cmake: Change cmake_llvm_rc separator from -- to ++ to avoid conflict Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5087
Diffstat (limited to 'Source')
-rw-r--r--Source/cmLocalGenerator.cxx25
-rw-r--r--Source/cmcmd.cxx8
2 files changed, 27 insertions, 6 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 7e35fe7..2380cce 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1938,6 +1938,9 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
this->AddConfigVariableFlags(flags, cmStrCat("CMAKE_", lang, "_FLAGS"),
config);
+ std::string const& compiler = this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_", lang, "_COMPILER_ID"));
+
if (lang == "Swift") {
if (cmProp v = target->GetProperty("Swift_LANGUAGE_VERSION")) {
if (cmSystemTools::VersionCompare(
@@ -1951,9 +1954,6 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
target->AddCUDAArchitectureFlags(flags);
target->AddCUDAToolkitFlags(flags);
- std::string const& compiler =
- this->Makefile->GetSafeDefinition("CMAKE_CUDA_COMPILER_ID");
-
if (compiler == "Clang") {
bool separable = target->GetPropertyAsBool("CUDA_SEPARABLE_COMPILATION");
@@ -1965,7 +1965,24 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
}
}
}
-
+ // Add VFS Overlay for Clang compiliers
+ if (compiler == "Clang") {
+ if (const char* vfsOverlay =
+ this->Makefile->GetDefinition("CMAKE_CLANG_VFS_OVERLAY")) {
+ std::string const& compilerSimulateId =
+ this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_", lang, "_SIMULATE_ID"));
+ if (compilerSimulateId == "MSVC") {
+ this->AppendCompileOptions(
+ flags,
+ std::vector<std::string>{ "-Xclang", "-ivfsoverlay", "-Xclang",
+ vfsOverlay });
+ } else {
+ this->AppendCompileOptions(
+ flags, std::vector<std::string>{ "-ivfsoverlay", vfsOverlay });
+ }
+ }
+ }
// Add MSVC runtime library flags. This is activated by the presence
// of a default selection whether or not it is overridden by a property.
cmProp msvcRuntimeLibraryDefault =
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 1a5fea1..a1c6771 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -1772,7 +1772,7 @@ int cmcmd::RunLLVMRC(std::vector<std::string> const& args)
// args[2] == source_file_path
// args[3] == intermediate_file
// args[4..n] == preprocess+args
- // args[n+1] == --
+ // args[n+1] == ++
// args[n+2...] == llvm-rc+args
if (args.size() < 3) {
std::cerr << "Invalid cmake_llvm_rc arguments";
@@ -1784,7 +1784,11 @@ int cmcmd::RunLLVMRC(std::vector<std::string> const& args)
std::vector<std::string> resource_compile;
std::vector<std::string>* pArgTgt = &preprocess;
for (std::string const& arg : cmMakeRange(args).advance(4)) {
- if (arg == "--") {
+ // We use ++ as seperator between the preprocessing step definition and the
+ // rc compilation step becase we need to prepend a -- to seperate the
+ // source file properly from other options when using clang-cl for
+ // preprocessing.
+ if (arg == "++") {
pArgTgt = &resource_compile;
} else {
if (arg.find("SOURCE_DIR") != std::string::npos) {