mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-04 05:10:10 -05:00
Merge branch 'cuda_vs_skip_computation' into release-3.18
Merge-request: !5422
This commit is contained in:
@@ -6914,6 +6914,14 @@ void cmGeneratorTarget::GetLanguages(std::set<std::string>& languages,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cmGeneratorTarget::IsLanguageUsed(std::string const& language,
|
||||||
|
std::string const& config) const
|
||||||
|
{
|
||||||
|
std::set<std::string> languages;
|
||||||
|
this->GetLanguages(languages, config);
|
||||||
|
return languages.count(language);
|
||||||
|
}
|
||||||
|
|
||||||
bool cmGeneratorTarget::IsCSharpOnly() const
|
bool cmGeneratorTarget::IsCSharpOnly() const
|
||||||
{
|
{
|
||||||
// Only certain target types may compile CSharp.
|
// Only certain target types may compile CSharp.
|
||||||
|
|||||||
@@ -397,6 +397,8 @@ public:
|
|||||||
// until we have per-target object file properties.
|
// until we have per-target object file properties.
|
||||||
void GetLanguages(std::set<std::string>& languages,
|
void GetLanguages(std::set<std::string>& languages,
|
||||||
std::string const& config) const;
|
std::string const& config) const;
|
||||||
|
bool IsLanguageUsed(std::string const& language,
|
||||||
|
std::string const& config) const;
|
||||||
|
|
||||||
bool IsCSharpOnly() const;
|
bool IsCSharpOnly() const;
|
||||||
|
|
||||||
|
|||||||
@@ -3018,7 +3018,8 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for (std::string const& c : this->Configurations) {
|
for (std::string const& c : this->Configurations) {
|
||||||
if (!this->ComputeCudaOptions(c)) {
|
if (this->GeneratorTarget->IsLanguageUsed("CUDA", c) &&
|
||||||
|
!this->ComputeCudaOptions(c)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3158,7 +3159,8 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions(
|
|||||||
void cmVisualStudio10TargetGenerator::WriteCudaOptions(
|
void cmVisualStudio10TargetGenerator::WriteCudaOptions(
|
||||||
Elem& e1, std::string const& configName)
|
Elem& e1, std::string const& configName)
|
||||||
{
|
{
|
||||||
if (!this->MSTools || !this->GlobalGenerator->IsCudaEnabled()) {
|
if (!this->MSTools || !this->GlobalGenerator->IsCudaEnabled() ||
|
||||||
|
!this->GeneratorTarget->IsLanguageUsed("CUDA", configName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Elem e2(e1, "CudaCompile");
|
Elem e2(e1, "CudaCompile");
|
||||||
|
|||||||
@@ -1,2 +1,6 @@
|
|||||||
|
# Make sure CMP0104 isn't issued for CXX targets created prior to enabling CUDA. See #21341.
|
||||||
|
enable_language(CXX)
|
||||||
|
add_library(cxx main.cxx)
|
||||||
|
|
||||||
enable_language(CUDA)
|
enable_language(CUDA)
|
||||||
add_library(cuda main.cu)
|
add_library(cuda main.cu)
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
int main()
|
||||||
|
{
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user