Browse Source

FASTBuild: Explicitly disallow CUDA language since it is not implemented

Issue: #27318
Eduard Voronkin 1 month ago
parent
commit
7953214454

+ 12 - 0
Source/cmGlobalFastbuildGenerator.cxx

@@ -297,6 +297,18 @@ cmGlobalFastbuildGenerator::NewFactory()
     new cmGlobalGeneratorSimpleFactory<cmGlobalFastbuildGenerator>());
 }
 
+bool cmGlobalFastbuildGenerator::CheckLanguages(
+  std::vector<std::string> const& languages, cmMakefile* mf) const
+{
+  if (std::find(languages.begin(), languages.end(), "CUDA") !=
+      languages.end()) {
+    mf->IssueMessage(MessageType::FATAL_ERROR,
+                     "The FASTBuild generator does not support CUDA yet.");
+    return false;
+  }
+  return true;
+}
+
 void cmGlobalFastbuildGenerator::EnableLanguage(
   std::vector<std::string> const& lang, cmMakefile* mf, bool optional)
 {

+ 2 - 0
Source/cmGlobalFastbuildGenerator.h

@@ -355,6 +355,8 @@ public:
 
   bool FindMakeProgram(cmMakefile* mf) override;
 
+  bool CheckLanguages(std::vector<std::string> const& languages,
+                      cmMakefile* mf) const override;
   void EnableLanguage(std::vector<std::string> const& lang, cmMakefile* mf,
                       bool optional) override;
 

+ 1 - 0
Tests/RunCMake/FASTBuild/CUDA-result.txt

@@ -0,0 +1 @@
+1

+ 4 - 0
Tests/RunCMake/FASTBuild/CUDA-stderr.txt

@@ -0,0 +1,4 @@
+^CMake Error at CUDA\.cmake:1 \(enable_language\):
+  The FASTBuild generator does not support CUDA yet\.
+Call Stack \(most recent call first\):
+  CMakeLists\.txt:[0-9]+ \(include\)

+ 1 - 0
Tests/RunCMake/FASTBuild/CUDA.cmake

@@ -0,0 +1 @@
+enable_language(CUDA)

+ 2 - 0
Tests/RunCMake/FASTBuild/RunCMakeTest.cmake

@@ -1,5 +1,7 @@
 include(RunCMake)
 
+run_cmake(CUDA)
+
 # Unity of size 1 doesn't make sense and shouldn't be created.
 run_cmake(Unity1)
 run_cmake(Unity2)