Просмотр исходного кода

cmVisualStudio10TargetGenerator: issue warning when adding static C# lib

Michael Stürmer 7 лет назад
Родитель
Сommit
8d7ffed048

+ 8 - 0
Source/cmVisualStudio10TargetGenerator.cxx

@@ -333,6 +333,14 @@ void cmVisualStudio10TargetGenerator::Generate()
     this->ProjectType = vcxproj;
     this->Managed = false;
   } else if (this->ProjectFileExtension == ".csproj") {
+    if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) {
+      std::string message = "The C# target \"" +
+        this->GeneratorTarget->GetName() +
+        "\" is of type STATIC_LIBRARY. This is discouraged (and may be "
+        "disabled in future). Make it a SHARED library instead.";
+      this->Makefile->IssueMessage(cmake::MessageType::DEPRECATION_WARNING,
+                                   message);
+    }
     this->ProjectType = csproj;
     this->Managed = true;
   }

+ 3 - 0
Tests/RunCMake/VS10Project/VsCSharpCustomTags-stderr.txt

@@ -0,0 +1,3 @@
+^CMake Deprecation Warning in CMakeLists.txt:
+  The C# target "foo" is of type STATIC_LIBRARY.  This is discouraged \(and
+  may be disabled in future\).  Make it a SHARED library instead.$

+ 8 - 0
Tests/RunCMake/VS10Project/VsCSharpReferenceProps-stderr.txt

@@ -0,0 +1,8 @@
+^CMake Deprecation Warning in CMakeLists.txt:
+  The C# target "foo2" is of type STATIC_LIBRARY.  This is discouraged \(and
+  may be disabled in future\).  Make it a SHARED library instead.
+
+
+CMake Deprecation Warning in CMakeLists.txt:
+  The C# target "foo" is of type STATIC_LIBRARY.  This is discouraged \(and
+  may be disabled in future\).  Make it a SHARED library instead.$