project: Add <PROJECT-NAME>_DESCRIPTION

For consistency with the VERSION keyword, also define the
<PROJECT-NAME>_DESCRIPTION variable.
This commit is contained in:
Craig Scott 2018-03-16 07:18:42 +11:00
parent 9b57cb62ea
commit fd28c382b4
4 changed files with 12 additions and 3 deletions

View File

@ -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``,

View File

@ -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

View File

@ -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.

View File

@ -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