summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-10-17 17:51:00 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-10-17 17:51:11 (GMT)
commitb903092b31389e21ff74dfccd4cbd7d9deeb7c22 (patch)
treeda20ead699093f7943fd38ebfb892a982603b8fe
parent095fc6d9d96bf9f12770f85ebf0b75d384a7d5fb (diff)
parent89ff3ee779f54e982e96b21b7d370371e639cc6f (diff)
downloadCMake-b903092b31389e21ff74dfccd4cbd7d9deeb7c22.zip
CMake-b903092b31389e21ff74dfccd4cbd7d9deeb7c22.tar.gz
CMake-b903092b31389e21ff74dfccd4cbd7d9deeb7c22.tar.bz2
Merge topic 'vs_dotnet_documentation_file'
89ff3ee779 VS: Add VS_DOTNET_DOCUMENTATION_FILE property Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3879
-rw-r--r--Help/manual/cmake-properties.7.rst1
-rw-r--r--Help/prop_tgt/VS_DOTNET_DOCUMENTATION_FILE.rst6
-rw-r--r--Help/release/dev/vs_dotnet_documentation_file.rst6
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx14
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h1
-rw-r--r--Tests/RunCMake/VS10Project/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/VS10Project/VsCSharpDocumentationFile-check.cmake26
-rw-r--r--Tests/RunCMake/VS10Project/VsCSharpDocumentationFile.cmake8
8 files changed, 63 insertions, 0 deletions
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 1369aa3..02e07eb 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -342,6 +342,7 @@ Properties on Targets
/prop_tgt/VS_DOTNET_REFERENCES
/prop_tgt/VS_DOTNET_REFERENCES_COPY_LOCAL
/prop_tgt/VS_DOTNET_TARGET_FRAMEWORK_VERSION
+ /prop_tgt/VS_DOTNET_DOCUMENTATION_FILE
/prop_tgt/VS_DPI_AWARE
/prop_tgt/VS_GLOBAL_KEYWORD
/prop_tgt/VS_GLOBAL_PROJECT_TYPES
diff --git a/Help/prop_tgt/VS_DOTNET_DOCUMENTATION_FILE.rst b/Help/prop_tgt/VS_DOTNET_DOCUMENTATION_FILE.rst
new file mode 100644
index 0000000..1bc361c
--- /dev/null
+++ b/Help/prop_tgt/VS_DOTNET_DOCUMENTATION_FILE.rst
@@ -0,0 +1,6 @@
+VS_DOTNET_DOCUMENTATION_FILE
+----------------------------
+
+Visual Studio managed project .NET documentation output
+
+Sets the target XML documentation file output.
diff --git a/Help/release/dev/vs_dotnet_documentation_file.rst b/Help/release/dev/vs_dotnet_documentation_file.rst
new file mode 100644
index 0000000..fdffb1c
--- /dev/null
+++ b/Help/release/dev/vs_dotnet_documentation_file.rst
@@ -0,0 +1,6 @@
+vs_dotnet_documentation_file
+----------------------------
+
+* The :prop_tgt:`VS_DOTNET_DOCUMENTATION_FILE` target property was added
+ to tell :ref:`Visual Studio Generators` to generate a ``DocumentationFile``
+ reference in ``.csproj`` files.
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 3843bf2..ca24a0f 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -676,6 +676,8 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WritePlatformExtensions(e1);
}
+
+ this->WriteDotNetDocumentationFile(e0);
Elem(e0, "PropertyGroup").Attribute("Label", "UserMacros");
this->WriteWinRTPackageCertificateKeyFile(e0);
this->WritePathAndIncrementalLinkOptions(e0);
@@ -910,6 +912,18 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferenceCustomTags(
}
}
+void cmVisualStudio10TargetGenerator::WriteDotNetDocumentationFile(Elem& e0)
+{
+ std::string const documentationFile =
+ this->GeneratorTarget->GetSafeProperty("VS_DOTNET_DOCUMENTATION_FILE");
+
+ if (this->ProjectType == csproj && !documentationFile.empty()) {
+ Elem e1(e0, "PropertyGroup");
+ Elem e2(e1, "DocumentationFile");
+ e2.Content(documentationFile);
+ }
+}
+
void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup(Elem& e0)
{
std::vector<cmSourceFile const*> resxObjs;
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index a18a33d..0835cde 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -79,6 +79,7 @@ private:
void WriteDotNetReference(Elem& e1, std::string const& ref,
std::string const& hint,
std::string const& config);
+ void WriteDotNetDocumentationFile(Elem& e0);
void WriteImports(Elem& e0);
void WriteDotNetReferenceCustomTags(Elem& e2, std::string const& ref);
void WriteEmbeddedResourceGroup(Elem& e0);
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
index 44ccd6b..ebc4d1c 100644
--- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
@@ -15,6 +15,7 @@ run_cmake(VsDebuggerCommand)
run_cmake(VsDebuggerCommandArguments)
run_cmake(VsDebuggerEnvironment)
run_cmake(VsCSharpCustomTags)
+run_cmake(VsCSharpDocumentationFile)
run_cmake(VsCSharpReferenceProps)
run_cmake(VsCSharpWithoutSources)
run_cmake(VsCSharpDeployFiles)
diff --git a/Tests/RunCMake/VS10Project/VsCSharpDocumentationFile-check.cmake b/Tests/RunCMake/VS10Project/VsCSharpDocumentationFile-check.cmake
new file mode 100644
index 0000000..0393362
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsCSharpDocumentationFile-check.cmake
@@ -0,0 +1,26 @@
+#
+# Check C# VS project for required elements
+#
+set(csProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.csproj")
+if(NOT EXISTS "${csProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${csProjectFile} does not exist.")
+ return()
+endif()
+
+file(STRINGS "${csProjectFile}" lines)
+
+set(HAVE_DocumentationFile 0)
+foreach(line IN LISTS lines)
+ if(line MATCHES "^ *<DocumentationFile>([^<>]+)</DocumentationFile>")
+ if(HAVE_DocumentationFile)
+ set(RunCMake_TEST_FAILED "Documentation node has been generated more than once for\n ${csProjectFile}")
+ return()
+ endif()
+ set(HAVE_DocumentationFile 1)
+ endif()
+endforeach()
+
+if(NOT HAVE_DocumentationFile)
+ set(RunCMake_TEST_FAILED "Documentation node has not been generated for\n ${csProjectFile}")
+ return()
+endif()
diff --git a/Tests/RunCMake/VS10Project/VsCSharpDocumentationFile.cmake b/Tests/RunCMake/VS10Project/VsCSharpDocumentationFile.cmake
new file mode 100644
index 0000000..83b6b97
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsCSharpDocumentationFile.cmake
@@ -0,0 +1,8 @@
+set(CMAKE_CONFIGURATION_TYPES Debug)
+enable_language(CSharp)
+
+add_library(foo SHARED
+ foo.cs)
+
+set_target_properties(foo PROPERTIES
+ VS_DOTNET_DOCUMENTATION_FILE foo.xml)