mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-17 12:40:40 -06:00
Clang: Add support for passing VFS arguments
This commit is contained in:
committed by
Brad King
parent
d993ebd4ca
commit
20ebaed972
@@ -158,6 +158,7 @@ Variables that Change Behavior
|
|||||||
/variable/CMAKE_AUTOMOC_RELAXED_MODE
|
/variable/CMAKE_AUTOMOC_RELAXED_MODE
|
||||||
/variable/CMAKE_BACKWARDS_COMPATIBILITY
|
/variable/CMAKE_BACKWARDS_COMPATIBILITY
|
||||||
/variable/CMAKE_BUILD_TYPE
|
/variable/CMAKE_BUILD_TYPE
|
||||||
|
/variable/CMAKE_CLANG_VFS_OVERLAY
|
||||||
/variable/CMAKE_CODEBLOCKS_COMPILER_ID
|
/variable/CMAKE_CODEBLOCKS_COMPILER_ID
|
||||||
/variable/CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES
|
/variable/CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES
|
||||||
/variable/CMAKE_CODELITE_USE_TARGETS
|
/variable/CMAKE_CODELITE_USE_TARGETS
|
||||||
|
|||||||
6
Help/release/dev/clang-cl-vfs.rst
Normal file
6
Help/release/dev/clang-cl-vfs.rst
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
clang-cl-vfs
|
||||||
|
------------
|
||||||
|
|
||||||
|
* A :variable:`CMAKE_CLANG_VFS_OVERLAY` variable was added to tell
|
||||||
|
Clang to use a VFS overlay to support the Windows SDK when
|
||||||
|
cross-compiling from hosts with case-sensitive filesystems.
|
||||||
9
Help/variable/CMAKE_CLANG_VFS_OVERLAY.rst
Normal file
9
Help/variable/CMAKE_CLANG_VFS_OVERLAY.rst
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
CMAKE_CLANG_VFS_OVERLAY
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
.. versionadded:: 3.19
|
||||||
|
|
||||||
|
When cross compiling for windows with clang-cl, this variable can be an
|
||||||
|
absolute path pointing to a clang virtual file system yaml file, which
|
||||||
|
will enable clang-cl to resolve windows header names on a case sensitive
|
||||||
|
file system.
|
||||||
@@ -1938,6 +1938,9 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
|
|||||||
this->AddConfigVariableFlags(flags, cmStrCat("CMAKE_", lang, "_FLAGS"),
|
this->AddConfigVariableFlags(flags, cmStrCat("CMAKE_", lang, "_FLAGS"),
|
||||||
config);
|
config);
|
||||||
|
|
||||||
|
std::string const& compiler = this->Makefile->GetSafeDefinition(
|
||||||
|
cmStrCat("CMAKE_", lang, "_COMPILER_ID"));
|
||||||
|
|
||||||
if (lang == "Swift") {
|
if (lang == "Swift") {
|
||||||
if (cmProp v = target->GetProperty("Swift_LANGUAGE_VERSION")) {
|
if (cmProp v = target->GetProperty("Swift_LANGUAGE_VERSION")) {
|
||||||
if (cmSystemTools::VersionCompare(
|
if (cmSystemTools::VersionCompare(
|
||||||
@@ -1951,9 +1954,6 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
|
|||||||
target->AddCUDAArchitectureFlags(flags);
|
target->AddCUDAArchitectureFlags(flags);
|
||||||
target->AddCUDAToolkitFlags(flags);
|
target->AddCUDAToolkitFlags(flags);
|
||||||
|
|
||||||
std::string const& compiler =
|
|
||||||
this->Makefile->GetSafeDefinition("CMAKE_CUDA_COMPILER_ID");
|
|
||||||
|
|
||||||
if (compiler == "Clang") {
|
if (compiler == "Clang") {
|
||||||
bool separable = target->GetPropertyAsBool("CUDA_SEPARABLE_COMPILATION");
|
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
|
// Add MSVC runtime library flags. This is activated by the presence
|
||||||
// of a default selection whether or not it is overridden by a property.
|
// of a default selection whether or not it is overridden by a property.
|
||||||
cmProp msvcRuntimeLibraryDefault =
|
cmProp msvcRuntimeLibraryDefault =
|
||||||
|
|||||||
Reference in New Issue
Block a user