• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1CMAKE_PROJECT_DESCRIPTION
2-------------------------
3
4.. versionadded:: 3.9
5
6The description of the top level project.
7
8This variable holds the description of the project as specified in the top
9level CMakeLists.txt file by a :command:`project` command.  In the event that
10the top level CMakeLists.txt contains multiple :command:`project` calls,
11the most recently called one from that top level CMakeLists.txt will determine
12the value that ``CMAKE_PROJECT_DESCRIPTION`` contains.  For example, consider
13the following top level CMakeLists.txt:
14
15.. code-block:: cmake
16
17  cmake_minimum_required(VERSION 3.0)
18  project(First DESCRIPTION "I am First")
19  project(Second DESCRIPTION "I am Second")
20  add_subdirectory(sub)
21  project(Third DESCRIPTION "I am Third")
22
23And ``sub/CMakeLists.txt`` with the following contents:
24
25.. code-block:: cmake
26
27  project(SubProj DESCRIPTION "I am SubProj")
28  message("CMAKE_PROJECT_DESCRIPTION = ${CMAKE_PROJECT_DESCRIPTION}")
29
30The most recently seen :command:`project` command from the top level
31CMakeLists.txt would be ``project(Second ...)``, so this will print::
32
33  CMAKE_PROJECT_DESCRIPTION = I am Second
34
35To obtain the description from the most recent call to :command:`project` in
36the current directory scope or above, see the :variable:`PROJECT_DESCRIPTION`
37variable.
38