Browse Source

project: Add <PROJECT-NAME>_DESCRIPTION

For consistency with the VERSION keyword, also define the
<PROJECT-NAME>_DESCRIPTION variable.
Craig Scott 7 years ago
parent
commit
fd28c382b4

+ 4 - 3
Help/command/project.rst

@@ -41,9 +41,10 @@ in variables
 Variables corresponding to unspecified versions are set to the empty string
 (if policy :policy:`CMP0048` is set to ``NEW``).
 
-If optional ``DESCRIPTION`` is given, then additional :variable:`PROJECT_DESCRIPTION`
-variable will be set to its argument. The argument must be a string with short
-description of the project (only a few words).
+If the optional ``DESCRIPTION`` is given, then :variable:`PROJECT_DESCRIPTION`
+and :variable:`<PROJECT-NAME>_DESCRIPTION` will be set to its argument.
+The description is expected to be a relatively short string, usually no more
+than a few words.
 
 Optionally you can specify which languages your project supports.
 Example languages include ``C``, ``CXX`` (i.e.  C++), ``CUDA``,

+ 1 - 0
Help/manual/cmake-variables.7.rst

@@ -97,6 +97,7 @@ Variables that Provide Information
    /variable/CMAKE_XCODE_GENERATE_SCHEME
    /variable/CMAKE_XCODE_PLATFORM_TOOLSET
    /variable/PROJECT-NAME_BINARY_DIR
+   /variable/PROJECT-NAME_DESCRIPTION
    /variable/PROJECT-NAME_SOURCE_DIR
    /variable/PROJECT-NAME_VERSION
    /variable/PROJECT-NAME_VERSION_MAJOR

+ 5 - 0
Help/variable/PROJECT-NAME_DESCRIPTION.rst

@@ -0,0 +1,5 @@
+<PROJECT-NAME>_DESCRIPTION
+--------------------------
+
+Value given to the ``DESCRIPTION`` option of the most recent call to the
+:command:`project` command with project name ``<PROJECT-NAME>``, if any.

+ 2 - 0
Source/cmProjectCommand.cxx

@@ -261,6 +261,8 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
 
   if (haveDescription) {
     this->Makefile->AddDefinition("PROJECT_DESCRIPTION", description.c_str());
+    this->Makefile->AddDefinition(projectName + "_DESCRIPTION",
+                                  description.c_str());
     // Set the CMAKE_PROJECT_DESCRIPTION variable to be the highest-level
     // project name in the tree. If there are two project commands
     // in the same CMakeLists.txt file, and it is the top level