[Cmake-commits] CMake branch, next, updated. v2.8.12.2-7325-g830d8f6
Brad King
brad.king at kitware.com
Wed Jan 29 09:50:54 EST 2014
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 830d8f6318321aa2af57d7ee66ce4616fdfc43ab (commit)
via 41d2f2c4cbf41bfe3ba7118c1fea0ed5e2f5f683 (commit)
via 7e142c5ac2be11097f7ff905b1606179803043d7 (commit)
via 16d040c958c68c38b2c0642b4094245af28c1910 (commit)
via 00007dcc365797f71ebba2c7d31ab20abc4019e6 (commit)
from 1ceedbf678e7d4c083f53da4e79e2f58226cc84e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=830d8f6318321aa2af57d7ee66ce4616fdfc43ab
commit 830d8f6318321aa2af57d7ee66ce4616fdfc43ab
Merge: 1ceedbf 41d2f2c
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Jan 29 09:50:52 2014 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Jan 29 09:50:52 2014 -0500
Merge topic 'project-version-variables' into next
41d2f2c4 write_basic_package_version_file: use PROJECT_VERSION
7e142c5a project: Manage VERSION variables
16d040c9 project: Add optional LANGUAGES keyword
00007dcc Help: Format project command and variable documentation
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=41d2f2c4cbf41bfe3ba7118c1fea0ed5e2f5f683
commit 41d2f2c4cbf41bfe3ba7118c1fea0ed5e2f5f683
Author: Alex Neundorf <neundorf at kde.org>
AuthorDate: Mon Jan 6 21:20:44 2014 +0100
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Jan 29 09:45:18 2014 -0500
write_basic_package_version_file: use PROJECT_VERSION
In the write_basic_package_version_file(), the VERSION argument
is now optional. If none is given, it falls back to ${PROJECT_VERSION}.
Alex
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index f388fe0..473bbe5 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -99,7 +99,7 @@
#
# ::
#
-# WRITE_BASIC_PACKAGE_VERSION_FILE( filename VERSION major.minor.patch COMPATIBILITY (AnyNewerVersion|SameMajorVersion|ExactVersion) )
+# WRITE_BASIC_PACKAGE_VERSION_FILE( filename [VERSION major.minor.patch] COMPATIBILITY (AnyNewerVersion|SameMajorVersion|ExactVersion) )
#
#
#
@@ -112,6 +112,9 @@
# filename is the output filename, it should be in the build tree.
# major.minor.patch is the version number of the project to be installed
#
+# If no ``VERSION`` is given, the :variable:`PROJECT_VERSION` variable
+# is used. If this hasn't been set, it errors out.
+#
# The COMPATIBILITY mode AnyNewerVersion means that the installed
# package version will be considered compatible if it is newer or
# exactly the same as the requested version. This mode should be used
diff --git a/Modules/WriteBasicConfigVersionFile.cmake b/Modules/WriteBasicConfigVersionFile.cmake
index 95187b4..7d28e95 100644
--- a/Modules/WriteBasicConfigVersionFile.cmake
+++ b/Modules/WriteBasicConfigVersionFile.cmake
@@ -6,7 +6,7 @@
#
# ::
#
-# WRITE_BASIC_CONFIG_VERSION_FILE( filename VERSION major.minor.patch COMPATIBILITY (AnyNewerVersion|SameMajorVersion) )
+# WRITE_BASIC_CONFIG_VERSION_FILE( filename [VERSION major.minor.patch] COMPATIBILITY (AnyNewerVersion|SameMajorVersion) )
#
#
#
@@ -46,7 +46,11 @@ function(WRITE_BASIC_CONFIG_VERSION_FILE _filename)
endif()
if("${CVF_VERSION}" STREQUAL "")
- message(FATAL_ERROR "No VERSION specified for WRITE_BASIC_CONFIG_VERSION_FILE()")
+ if ("${PROJECT_VERSION}" STREQUAL "")
+ message(FATAL_ERROR "No VERSION specified for WRITE_BASIC_CONFIG_VERSION_FILE()")
+ else()
+ set(CVF_VERSION "${PROJECT_VERSION}")
+ endif()
endif()
configure_file("${versionTemplateFile}" "${_filename}" @ONLY)
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7e142c5ac2be11097f7ff905b1606179803043d7
commit 7e142c5ac2be11097f7ff905b1606179803043d7
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Jan 29 09:28:01 2014 -0500
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Jan 29 09:45:18 2014 -0500
project: Manage VERSION variables
Teach the project() command to set variables
{PROJECT,<PROJECT-NAME>}_VERSION{,_MAJOR,_MINOR,_PATCH,_TWEAK}
holding the project version number and its components. Add project()
command option "VERSION" to specify the version explicitly, and default
to the empty string when it is not given.
Since this clears variables when no VERSION is given, this may change
behavior for existing projects that set the version variables themselves
prior to calling project(). Add policy CMP0048 for compatibility.
Suggested-by: Alex Neundorf <neundorf at kde.org>
diff --git a/Help/command/project.rst b/Help/command/project.rst
index aabab65..c601a01 100644
--- a/Help/command/project.rst
+++ b/Help/command/project.rst
@@ -1,11 +1,14 @@
project
-------
-Set a name and enable languages for the entire project.
+Set a name, version, and enable languages for the entire project.
.. code-block:: cmake
project(<PROJECT-NAME> [LANGUAGES] [<language-name>...])
+ project(<PROJECT-NAME>
+ [VERSION <major>[.<minor>[.<patch>[.<tweak>]]]]
+ [LANGUAGES <language-name>...])
Sets the name of the project and stores the name in the
:variable:`PROJECT_NAME` variable. Additionally this sets variables
@@ -15,6 +18,28 @@ Sets the name of the project and stores the name in the
* :variable:`PROJECT_BINARY_DIR`,
:variable:`<PROJECT-NAME>_BINARY_DIR`
+If ``VERSION`` is specified, given components must be non-negative integers.
+If ``VERSION`` is not specified, the default version is the empty string.
+The ``VERSION`` option may not be used unless policy :policy:`CMP0048` is
+set to ``NEW``.
+
+The :command:`project()` command stores the version number and its components
+in variables
+
+* :variable:`PROJECT_VERSION`,
+ :variable:`<PROJECT-NAME>_VERSION`
+* :variable:`PROJECT_VERSION_MAJOR`,
+ :variable:`<PROJECT-NAME>_VERSION_MAJOR`
+* :variable:`PROJECT_VERSION_MINOR`,
+ :variable:`<PROJECT-NAME>_VERSION_MINOR`
+* :variable:`PROJECT_VERSION_PATCH`,
+ :variable:`<PROJECT-NAME>_VERSION_PATCH`
+* :variable:`PROJECT_VERSION_TWEAK`,
+ :variable:`<PROJECT-NAME>_VERSION_TWEAK`
+
+Variables corresponding to unspecified versions are set to the empty string
+(if policy :policy:`CMP0048` is set to ``NEW``).
+
Optionally you can specify which languages your project supports.
Example languages are ``C``, ``CXX`` (i.e. C++), ``Fortran``, etc.
By default ``C`` and ``CXX`` are enabled if no language options are
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index 02f596b..5a9ec95 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -99,3 +99,4 @@ All Policies
/policy/CMP0045
/policy/CMP0046
/policy/CMP0047
+ /policy/CMP0048
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index f363f94..c4ae193 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -79,7 +79,17 @@ Variables that Provide Information
/variable/PROJECT-NAME_BINARY_DIR
/variable/PROJECT_NAME
/variable/PROJECT-NAME_SOURCE_DIR
+ /variable/PROJECT-NAME_VERSION
+ /variable/PROJECT-NAME_VERSION_MAJOR
+ /variable/PROJECT-NAME_VERSION_MINOR
+ /variable/PROJECT-NAME_VERSION_PATCH
+ /variable/PROJECT-NAME_VERSION_TWEAK
/variable/PROJECT_SOURCE_DIR
+ /variable/PROJECT_VERSION
+ /variable/PROJECT_VERSION_MAJOR
+ /variable/PROJECT_VERSION_MINOR
+ /variable/PROJECT_VERSION_PATCH
+ /variable/PROJECT_VERSION_TWEAK
Variables that Change Behavior
==============================
diff --git a/Help/policy/CMP0048.rst b/Help/policy/CMP0048.rst
new file mode 100644
index 0000000..ae51329
--- /dev/null
+++ b/Help/policy/CMP0048.rst
@@ -0,0 +1,22 @@
+CMP0048
+-------
+
+The :command:`project` command manages VERSION variables.
+
+CMake version 3.0.0 introduced the ``VERSION`` option of the :command:`project`
+command to specify a project version as well as the name. In order to keep
+:variable:`PROJECT_VERSION` and related variables consistent with variable
+:variable:`PROJECT_NAME` it is necessary to set the VERSION variables
+to the empty string when no ``VERSION`` is given to :command:`project`.
+However, this can change behavior for existing projects that set VERSION
+variables themselves since :command:`project` may now clear them.
+This policy controls the behavior for compatibility with such projects.
+
+The OLD behavior for this policy is to leave VERSION variables untouched.
+The NEW behavior for this policy is to set VERSION as documented by the
+:command:`project` command.
+
+This policy was introduced in CMake version 3.0.0.
+CMake version |release| warns when the policy is not set and uses
+OLD behavior. Use the cmake_policy command to set it to OLD or
+NEW explicitly.
diff --git a/Help/variable/PROJECT-NAME_VERSION.rst b/Help/variable/PROJECT-NAME_VERSION.rst
new file mode 100644
index 0000000..0f6ed51
--- /dev/null
+++ b/Help/variable/PROJECT-NAME_VERSION.rst
@@ -0,0 +1,11 @@
+<PROJECT-NAME>_VERSION
+----------------------
+
+Value given to the ``VERSION`` option of the most recent call to the
+:command:`project` command with project name ``<PROJECT-NAME>``, if any.
+
+See also the component-wise version variables
+:variable:`<PROJECT-NAME>_VERSION_MAJOR`,
+:variable:`<PROJECT-NAME>_VERSION_MINOR`,
+:variable:`<PROJECT-NAME>_VERSION_PATCH`, and
+:variable:`<PROJECT-NAME>_VERSION_TWEAK`.
diff --git a/Help/variable/PROJECT-NAME_VERSION_MAJOR.rst b/Help/variable/PROJECT-NAME_VERSION_MAJOR.rst
new file mode 100644
index 0000000..9e2d755
--- /dev/null
+++ b/Help/variable/PROJECT-NAME_VERSION_MAJOR.rst
@@ -0,0 +1,5 @@
+<PROJECT-NAME>_VERSION_MAJOR
+----------------------------
+
+First version number component of the :variable:`<PROJECT-NAME>_VERSION`
+variable as set by the :command:`project` command.
diff --git a/Help/variable/PROJECT-NAME_VERSION_MINOR.rst b/Help/variable/PROJECT-NAME_VERSION_MINOR.rst
new file mode 100644
index 0000000..fa2cdab
--- /dev/null
+++ b/Help/variable/PROJECT-NAME_VERSION_MINOR.rst
@@ -0,0 +1,5 @@
+<PROJECT-NAME>_VERSION_MINOR
+----------------------------
+
+Second version number component of the :variable:`<PROJECT-NAME>_VERSION`
+variable as set by the :command:`project` command.
diff --git a/Help/variable/PROJECT-NAME_VERSION_PATCH.rst b/Help/variable/PROJECT-NAME_VERSION_PATCH.rst
new file mode 100644
index 0000000..85b5e6b
--- /dev/null
+++ b/Help/variable/PROJECT-NAME_VERSION_PATCH.rst
@@ -0,0 +1,5 @@
+<PROJECT-NAME>_VERSION_PATCH
+----------------------------
+
+Third version number component of the :variable:`<PROJECT-NAME>_VERSION`
+variable as set by the :command:`project` command.
diff --git a/Help/variable/PROJECT-NAME_VERSION_TWEAK.rst b/Help/variable/PROJECT-NAME_VERSION_TWEAK.rst
new file mode 100644
index 0000000..65c4044
--- /dev/null
+++ b/Help/variable/PROJECT-NAME_VERSION_TWEAK.rst
@@ -0,0 +1,5 @@
+<PROJECT-NAME>_VERSION_TWEAK
+----------------------------
+
+Fourth version number component of the :variable:`<PROJECT-NAME>_VERSION`
+variable as set by the :command:`project` command.
diff --git a/Help/variable/PROJECT_VERSION.rst b/Help/variable/PROJECT_VERSION.rst
new file mode 100644
index 0000000..234558d
--- /dev/null
+++ b/Help/variable/PROJECT_VERSION.rst
@@ -0,0 +1,11 @@
+PROJECT_VERSION
+---------------
+
+Value given to the ``VERSION`` option of the most recent call to the
+:command:`project` command, if any.
+
+See also the component-wise version variables
+:variable:`PROJECT_VERSION_MAJOR`,
+:variable:`PROJECT_VERSION_MINOR`,
+:variable:`PROJECT_VERSION_PATCH`, and
+:variable:`PROJECT_VERSION_TWEAK`.
diff --git a/Help/variable/PROJECT_VERSION_MAJOR.rst b/Help/variable/PROJECT_VERSION_MAJOR.rst
new file mode 100644
index 0000000..4b6072c
--- /dev/null
+++ b/Help/variable/PROJECT_VERSION_MAJOR.rst
@@ -0,0 +1,5 @@
+PROJECT_VERSION_MAJOR
+---------------------
+
+First version number component of the :variable:`PROJECT_VERSION`
+variable as set by the :command:`project` command.
diff --git a/Help/variable/PROJECT_VERSION_MINOR.rst b/Help/variable/PROJECT_VERSION_MINOR.rst
new file mode 100644
index 0000000..5f31220
--- /dev/null
+++ b/Help/variable/PROJECT_VERSION_MINOR.rst
@@ -0,0 +1,5 @@
+PROJECT_VERSION_MINOR
+---------------------
+
+Second version number component of the :variable:`PROJECT_VERSION`
+variable as set by the :command:`project` command.
diff --git a/Help/variable/PROJECT_VERSION_PATCH.rst b/Help/variable/PROJECT_VERSION_PATCH.rst
new file mode 100644
index 0000000..ac72ec0
--- /dev/null
+++ b/Help/variable/PROJECT_VERSION_PATCH.rst
@@ -0,0 +1,5 @@
+PROJECT_VERSION_PATCH
+---------------------
+
+Third version number component of the :variable:`PROJECT_VERSION`
+variable as set by the :command:`project` command.
diff --git a/Help/variable/PROJECT_VERSION_TWEAK.rst b/Help/variable/PROJECT_VERSION_TWEAK.rst
new file mode 100644
index 0000000..d7f96d6
--- /dev/null
+++ b/Help/variable/PROJECT_VERSION_TWEAK.rst
@@ -0,0 +1,5 @@
+PROJECT_VERSION_TWEAK
+---------------------
+
+Fourth version number component of the :variable:`PROJECT_VERSION`
+variable as set by the :command:`project` command.
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index a1451f1..e191256 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -341,6 +341,11 @@ cmPolicies::cmPolicies()
CMP0047, "CMP0047",
"Use QCC compiler id for the qcc drivers on QNX.",
3,0,0,0, cmPolicies::WARN);
+
+ this->DefinePolicy(
+ CMP0048, "CMP0048",
+ "project() command manages VERSION variables.",
+ 3,0,0,0, cmPolicies::WARN);
}
cmPolicies::~cmPolicies()
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index d1bba7b..42271dd 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -101,6 +101,7 @@ public:
CMP0045, ///< Error on non-existent target in get_target_property
CMP0046, ///< Error on non-existent dependency in add_dependencies
CMP0047, ///< Use QCC compiler id for the qcc drivers on QNX.
+ CMP0048, ///< project() command manages VERSION variables
/** \brief Always the last entry.
*
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 1dcb72b..a9ce0cc 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -62,8 +62,12 @@ bool cmProjectCommand
"Value Computed by CMake", cmCacheManager::STATIC);
}
+ bool haveVersion = false;
bool haveLanguages = false;
+ std::string version;
std::vector<std::string> languages;
+ enum Doing { DoingLanguages, DoingVersion };
+ Doing doing = DoingLanguages;
for(size_t i = 1; i < args.size(); ++i)
{
if(args[i] == "LANGUAGES")
@@ -76,18 +80,149 @@ bool cmProjectCommand
return true;
}
haveLanguages = true;
+ doing = DoingLanguages;
}
- else
+ else if (args[i] == "VERSION")
+ {
+ if(haveVersion)
+ {
+ this->Makefile->IssueMessage
+ (cmake::FATAL_ERROR, "VERSION may be specified at most once.");
+ cmSystemTools::SetFatalErrorOccured();
+ return true;
+ }
+ haveVersion = true;
+ doing = DoingVersion;
+ }
+ else if(doing == DoingVersion)
+ {
+ doing = DoingLanguages;
+ version = args[i];
+ }
+ else // doing == DoingLanguages
{
languages.push_back(args[i]);
}
}
+ if (haveVersion && !haveLanguages && !languages.empty())
+ {
+ this->Makefile->IssueMessage
+ (cmake::FATAL_ERROR,
+ "project with VERSION must use LANGUAGES before language names.");
+ cmSystemTools::SetFatalErrorOccured();
+ return true;
+ }
if (haveLanguages && languages.empty())
{
languages.push_back("NONE");
}
+ cmPolicies::PolicyStatus cmp0048 =
+ this->Makefile->GetPolicyStatus(cmPolicies::CMP0048);
+ if (haveVersion)
+ {
+ // Set project VERSION variables to given values
+ if (cmp0048 == cmPolicies::OLD ||
+ cmp0048 == cmPolicies::WARN)
+ {
+ this->Makefile->IssueMessage
+ (cmake::FATAL_ERROR,
+ "VERSION not allowed unless CMP0048 is set to NEW");
+ cmSystemTools::SetFatalErrorOccured();
+ return true;
+ }
+
+ cmsys::RegularExpression
+ vx("^([0-9]+(\\.[0-9]+(\\.[0-9]+(\\.[0-9]+)?)?)?)?$");
+ if(!vx.find(version))
+ {
+ std::string e = "VERSION \"" + version + "\" format invalid.";
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e);
+ cmSystemTools::SetFatalErrorOccured();
+ return true;
+ }
+
+ std::string vs;
+ const char* sep = "";
+ char vb[4][64];
+ unsigned int v[4] = {0,0,0,0};
+ int vc = sscanf(version.c_str(), "%u.%u.%u.%u",
+ &v[0], &v[1], &v[2], &v[3]);
+ for(int i=0; i < 4; ++i)
+ {
+ if(i < vc)
+ {
+ sprintf(vb[i], "%u", v[i]);
+ vs += sep;
+ vs += vb[i];
+ sep = ".";
+ }
+ else
+ {
+ vb[i][0] = 0;
+ }
+ }
+
+ std::string vv;
+ vv = args[0] + "_VERSION";
+ this->Makefile->AddDefinition("PROJECT_VERSION", vs.c_str());
+ this->Makefile->AddDefinition(vv.c_str(), vs.c_str());
+ vv = args[0] + "_VERSION_MAJOR";
+ this->Makefile->AddDefinition("PROJECT_VERSION_MAJOR", vb[0]);
+ this->Makefile->AddDefinition(vv.c_str(), vb[0]);
+ vv = args[0] + "_VERSION_MINOR";
+ this->Makefile->AddDefinition("PROJECT_VERSION_MINOR", vb[1]);
+ this->Makefile->AddDefinition(vv.c_str(), vb[1]);
+ vv = args[0] + "_VERSION_PATCH";
+ this->Makefile->AddDefinition("PROJECT_VERSION_PATCH", vb[2]);
+ this->Makefile->AddDefinition(vv.c_str(), vb[2]);
+ vv = args[0] + "_VERSION_TWEAK";
+ this->Makefile->AddDefinition("PROJECT_VERSION_TWEAK", vb[3]);
+ this->Makefile->AddDefinition(vv.c_str(), vb[3]);
+ }
+ else if(cmp0048 != cmPolicies::OLD)
+ {
+ // Set project VERSION variables to empty
+ std::vector<std::string> vv;
+ vv.push_back("PROJECT_VERSION");
+ vv.push_back("PROJECT_VERSION_MAJOR");
+ vv.push_back("PROJECT_VERSION_MINOR");
+ vv.push_back("PROJECT_VERSION_PATCH");
+ vv.push_back("PROJECT_VERSION_TWEAK");
+ vv.push_back(args[0] + "_VERSION");
+ vv.push_back(args[0] + "_VERSION_MAJOR");
+ vv.push_back(args[0] + "_VERSION_MINOR");
+ vv.push_back(args[0] + "_VERSION_PATCH");
+ vv.push_back(args[0] + "_VERSION_TWEAK");
+ std::string vw;
+ for(std::vector<std::string>::iterator i = vv.begin();
+ i != vv.end(); ++i)
+ {
+ const char* v = this->Makefile->GetDefinition(i->c_str());
+ if(v && *v)
+ {
+ if(cmp0048 == cmPolicies::WARN)
+ {
+ vw += "\n ";
+ vw += *i;
+ }
+ else
+ {
+ this->Makefile->AddDefinition(i->c_str(), "");
+ }
+ }
+ }
+ if(!vw.empty())
+ {
+ cmOStringStream w;
+ w << (this->Makefile->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0048))
+ << "\nThe following variable(s) would be set to empty:" << vw;
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
+ }
+ }
+
if (languages.empty())
{
// if no language is specified do c and c++
diff --git a/Tests/RunCMake/project/CMP0048-NEW-stderr.txt b/Tests/RunCMake/project/CMP0048-NEW-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/project/CMP0048-NEW-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/project/CMP0048-NEW-stdout.txt b/Tests/RunCMake/project/CMP0048-NEW-stdout.txt
new file mode 100644
index 0000000..38261e5
--- /dev/null
+++ b/Tests/RunCMake/project/CMP0048-NEW-stdout.txt
@@ -0,0 +1,30 @@
+-- PROJECT_VERSION='1.2.3.4'
+-- ProjectA_VERSION='1.2.3.4'
+-- PROJECT_VERSION_MAJOR='1'
+-- ProjectA_VERSION_MAJOR='1'
+-- PROJECT_VERSION_MINOR='2'
+-- ProjectA_VERSION_MINOR='2'
+-- PROJECT_VERSION_PATCH='3'
+-- ProjectA_VERSION_PATCH='3'
+-- PROJECT_VERSION_TWEAK='4'
+-- ProjectA_VERSION_TWEAK='4'
+-- PROJECT_VERSION='0.1.2'
+-- ProjectB_VERSION='0.1.2'
+-- PROJECT_VERSION_MAJOR='0'
+-- ProjectB_VERSION_MAJOR='0'
+-- PROJECT_VERSION_MINOR='1'
+-- ProjectB_VERSION_MINOR='1'
+-- PROJECT_VERSION_PATCH='2'
+-- ProjectB_VERSION_PATCH='2'
+-- PROJECT_VERSION_TWEAK=''
+-- ProjectB_VERSION_TWEAK=''
+-- PROJECT_VERSION=''
+-- ProjectC_VERSION=''
+-- PROJECT_VERSION_MAJOR=''
+-- ProjectC_VERSION_MAJOR=''
+-- PROJECT_VERSION_MINOR=''
+-- ProjectC_VERSION_MINOR=''
+-- PROJECT_VERSION_PATCH=''
+-- ProjectC_VERSION_PATCH=''
+-- PROJECT_VERSION_TWEAK=''
+-- ProjectC_VERSION_TWEAK=''
diff --git a/Tests/RunCMake/project/CMP0048-NEW.cmake b/Tests/RunCMake/project/CMP0048-NEW.cmake
new file mode 100644
index 0000000..7e16b70
--- /dev/null
+++ b/Tests/RunCMake/project/CMP0048-NEW.cmake
@@ -0,0 +1,19 @@
+macro(print_versions name)
+ foreach(v "" _MAJOR _MINOR _PATCH _TWEAK)
+ message(STATUS "PROJECT_VERSION${v}='${PROJECT_VERSION${v}}'")
+ message(STATUS "${name}_VERSION${v}='${${name}_VERSION${v}}'")
+ endforeach()
+endmacro()
+
+cmake_policy(SET CMP0048 NEW)
+
+project(ProjectA VERSION 1.2.3.4 LANGUAGES NONE)
+print_versions(ProjectA)
+
+project(ProjectB VERSION 0.1.2 LANGUAGES NONE)
+print_versions(ProjectB)
+
+set(PROJECT_VERSION 1)
+set(ProjectC_VERSION 1)
+project(ProjectC NONE)
+print_versions(ProjectC)
diff --git a/Tests/RunCMake/project/CMP0048-OLD-VERSION-result.txt b/Tests/RunCMake/project/CMP0048-OLD-VERSION-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/project/CMP0048-OLD-VERSION-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/project/CMP0048-OLD-VERSION-stderr.txt b/Tests/RunCMake/project/CMP0048-OLD-VERSION-stderr.txt
new file mode 100644
index 0000000..3a13d32
--- /dev/null
+++ b/Tests/RunCMake/project/CMP0048-OLD-VERSION-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at CMP0048-OLD-VERSION.cmake:1 \(project\):
+ VERSION not allowed unless CMP0048 is set to NEW
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/project/CMP0048-OLD-VERSION.cmake b/Tests/RunCMake/project/CMP0048-OLD-VERSION.cmake
new file mode 100644
index 0000000..6fbbe0a
--- /dev/null
+++ b/Tests/RunCMake/project/CMP0048-OLD-VERSION.cmake
@@ -0,0 +1,2 @@
+project(MyProject VERSION 1 LANGUAGES NONE)
+message("This line not reached.")
diff --git a/Tests/RunCMake/project/CMP0048-OLD-stdout.txt b/Tests/RunCMake/project/CMP0048-OLD-stdout.txt
new file mode 100644
index 0000000..1a25c7b
--- /dev/null
+++ b/Tests/RunCMake/project/CMP0048-OLD-stdout.txt
@@ -0,0 +1,2 @@
+-- PROJECT_VERSION='1'
+-- MyProject_VERSION_TWEAK='0'
diff --git a/Tests/RunCMake/project/CMP0048-OLD.cmake b/Tests/RunCMake/project/CMP0048-OLD.cmake
new file mode 100644
index 0000000..6c32d2c
--- /dev/null
+++ b/Tests/RunCMake/project/CMP0048-OLD.cmake
@@ -0,0 +1,6 @@
+cmake_policy(SET CMP0048 OLD)
+set(PROJECT_VERSION 1)
+set(MyProject_VERSION_TWEAK 0)
+project(MyProject NONE)
+message(STATUS "PROJECT_VERSION='${PROJECT_VERSION}'")
+message(STATUS "MyProject_VERSION_TWEAK='${MyProject_VERSION_TWEAK}'")
diff --git a/Tests/RunCMake/project/CMP0048-WARN-stderr.txt b/Tests/RunCMake/project/CMP0048-WARN-stderr.txt
new file mode 100644
index 0000000..6d29ad2
--- /dev/null
+++ b/Tests/RunCMake/project/CMP0048-WARN-stderr.txt
@@ -0,0 +1,12 @@
+CMake Warning \(dev\) at CMP0048-WARN.cmake:3 \(project\):
+ Policy CMP0048 is not set: project\(\) command manages VERSION variables.
+ Run "cmake --help-policy CMP0048" for policy details. Use the cmake_policy
+ command to set the policy and suppress this warning.
+
+ The following variable\(s\) would be set to empty:
+
+ PROJECT_VERSION
+ MyProject_VERSION_TWEAK
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/project/CMP0048-WARN.cmake b/Tests/RunCMake/project/CMP0048-WARN.cmake
new file mode 100644
index 0000000..97359e6
--- /dev/null
+++ b/Tests/RunCMake/project/CMP0048-WARN.cmake
@@ -0,0 +1,3 @@
+set(PROJECT_VERSION 1)
+set(MyProject_VERSION_TWEAK 0)
+project(MyProject NONE)
diff --git a/Tests/RunCMake/project/RunCMakeTest.cmake b/Tests/RunCMake/project/RunCMakeTest.cmake
index cac0f46..6ab0fc9 100644
--- a/Tests/RunCMake/project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/project/RunCMakeTest.cmake
@@ -4,3 +4,14 @@ run_cmake(LanguagesImplicit)
run_cmake(LanguagesEmpty)
run_cmake(LanguagesNONE)
run_cmake(LanguagesTwice)
+run_cmake(VersionAndLanguagesEmpty)
+run_cmake(VersionEmpty)
+run_cmake(VersionInvalid)
+run_cmake(VersionMissingLanguages)
+run_cmake(VersionMissingValueOkay)
+run_cmake(VersionTwice)
+
+run_cmake(CMP0048-OLD)
+run_cmake(CMP0048-OLD-VERSION)
+run_cmake(CMP0048-WARN)
+run_cmake(CMP0048-NEW)
diff --git a/Tests/RunCMake/project/VersionAndLanguagesEmpty-stdout.txt b/Tests/RunCMake/project/VersionAndLanguagesEmpty-stdout.txt
new file mode 100644
index 0000000..eae7da7
--- /dev/null
+++ b/Tests/RunCMake/project/VersionAndLanguagesEmpty-stdout.txt
@@ -0,0 +1,2 @@
+-- ENABLED_LANGUAGES='NONE'
+-- PROJECT_VERSION='1'
diff --git a/Tests/RunCMake/project/VersionAndLanguagesEmpty.cmake b/Tests/RunCMake/project/VersionAndLanguagesEmpty.cmake
new file mode 100644
index 0000000..d6056ce
--- /dev/null
+++ b/Tests/RunCMake/project/VersionAndLanguagesEmpty.cmake
@@ -0,0 +1,5 @@
+cmake_policy(SET CMP0048 NEW)
+project(ProjectA VERSION 1 LANGUAGES NONE)
+get_property(langs GLOBAL PROPERTY ENABLED_LANGUAGES)
+message(STATUS "ENABLED_LANGUAGES='${langs}'")
+message(STATUS "PROJECT_VERSION='${PROJECT_VERSION}'")
diff --git a/Tests/RunCMake/project/VersionEmpty-stdout.txt b/Tests/RunCMake/project/VersionEmpty-stdout.txt
new file mode 100644
index 0000000..3ae42e0
--- /dev/null
+++ b/Tests/RunCMake/project/VersionEmpty-stdout.txt
@@ -0,0 +1,2 @@
+-- ENABLED_LANGUAGES='NONE'
+-- PROJECT_VERSION=''
diff --git a/Tests/RunCMake/project/VersionEmpty.cmake b/Tests/RunCMake/project/VersionEmpty.cmake
new file mode 100644
index 0000000..0cfb291
--- /dev/null
+++ b/Tests/RunCMake/project/VersionEmpty.cmake
@@ -0,0 +1,6 @@
+cmake_policy(SET CMP0048 NEW)
+set(PROJECT_VERSION 1)
+project(ProjectA VERSION "" LANGUAGES NONE)
+get_property(langs GLOBAL PROPERTY ENABLED_LANGUAGES)
+message(STATUS "ENABLED_LANGUAGES='${langs}'")
+message(STATUS "PROJECT_VERSION='${PROJECT_VERSION}'")
diff --git a/Tests/RunCMake/project/VersionInvalid-result.txt b/Tests/RunCMake/project/VersionInvalid-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/project/VersionInvalid-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/project/VersionInvalid-stderr.txt b/Tests/RunCMake/project/VersionInvalid-stderr.txt
new file mode 100644
index 0000000..48358d1
--- /dev/null
+++ b/Tests/RunCMake/project/VersionInvalid-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at VersionInvalid.cmake:2 \(project\):
+ VERSION "NONE" format invalid.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/project/VersionInvalid.cmake b/Tests/RunCMake/project/VersionInvalid.cmake
new file mode 100644
index 0000000..8d5dd7f
--- /dev/null
+++ b/Tests/RunCMake/project/VersionInvalid.cmake
@@ -0,0 +1,3 @@
+cmake_policy(SET CMP0048 NEW)
+project(ProjectA VERSION NONE)
+message("This line not reached.")
diff --git a/Tests/RunCMake/project/VersionMissingLanguages-result.txt b/Tests/RunCMake/project/VersionMissingLanguages-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/project/VersionMissingLanguages-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/project/VersionMissingLanguages-stderr.txt b/Tests/RunCMake/project/VersionMissingLanguages-stderr.txt
new file mode 100644
index 0000000..52433bc
--- /dev/null
+++ b/Tests/RunCMake/project/VersionMissingLanguages-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at VersionMissingLanguages.cmake:2 \(project\):
+ project with VERSION must use LANGUAGES before language names.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/project/VersionMissingLanguages.cmake b/Tests/RunCMake/project/VersionMissingLanguages.cmake
new file mode 100644
index 0000000..dc41514
--- /dev/null
+++ b/Tests/RunCMake/project/VersionMissingLanguages.cmake
@@ -0,0 +1,3 @@
+cmake_policy(SET CMP0048 NEW)
+project(ProjectA VERSION 1 NONE)
+message("This line not reached.")
diff --git a/Tests/RunCMake/project/VersionMissingValueOkay-stdout.txt b/Tests/RunCMake/project/VersionMissingValueOkay-stdout.txt
new file mode 100644
index 0000000..3ae42e0
--- /dev/null
+++ b/Tests/RunCMake/project/VersionMissingValueOkay-stdout.txt
@@ -0,0 +1,2 @@
+-- ENABLED_LANGUAGES='NONE'
+-- PROJECT_VERSION=''
diff --git a/Tests/RunCMake/project/VersionMissingValueOkay.cmake b/Tests/RunCMake/project/VersionMissingValueOkay.cmake
new file mode 100644
index 0000000..1fb1437
--- /dev/null
+++ b/Tests/RunCMake/project/VersionMissingValueOkay.cmake
@@ -0,0 +1,6 @@
+cmake_policy(SET CMP0048 NEW)
+set(PROJECT_VERSION 1)
+project(ProjectA VERSION LANGUAGES NONE)
+get_property(langs GLOBAL PROPERTY ENABLED_LANGUAGES)
+message(STATUS "ENABLED_LANGUAGES='${langs}'")
+message(STATUS "PROJECT_VERSION='${PROJECT_VERSION}'")
diff --git a/Tests/RunCMake/project/VersionTwice-result.txt b/Tests/RunCMake/project/VersionTwice-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/project/VersionTwice-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/project/VersionTwice-stderr.txt b/Tests/RunCMake/project/VersionTwice-stderr.txt
new file mode 100644
index 0000000..ec07ead
--- /dev/null
+++ b/Tests/RunCMake/project/VersionTwice-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at VersionTwice.cmake:2 \(project\):
+ VERSION may be specified at most once.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/project/VersionTwice.cmake b/Tests/RunCMake/project/VersionTwice.cmake
new file mode 100644
index 0000000..dc0c996
--- /dev/null
+++ b/Tests/RunCMake/project/VersionTwice.cmake
@@ -0,0 +1,3 @@
+cmake_policy(SET CMP0048 NEW)
+project(ProjectA VERSION 1 VERSION)
+message("This line not reached.")
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=16d040c958c68c38b2c0642b4094245af28c1910
commit 16d040c958c68c38b2c0642b4094245af28c1910
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Jan 29 09:28:01 2014 -0500
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Jan 29 09:40:51 2014 -0500
project: Add optional LANGUAGES keyword
Teach the project() command to recognize an optional "LANGUAGES"
keyword after the project name and prior to the list of languages.
Do not allow multiple copies of the keyword. If the keyword is
specified and no languages are listed, imply NONE.
diff --git a/Help/command/project.rst b/Help/command/project.rst
index cb7d3fc..aabab65 100644
--- a/Help/command/project.rst
+++ b/Help/command/project.rst
@@ -5,7 +5,7 @@ Set a name and enable languages for the entire project.
.. code-block:: cmake
- project(<PROJECT-NAME> [<language-name>...])
+ project(<PROJECT-NAME> [LANGUAGES] [<language-name>...])
Sets the name of the project and stores the name in the
:variable:`PROJECT_NAME` variable. Additionally this sets variables
@@ -18,7 +18,8 @@ Sets the name of the project and stores the name in the
Optionally you can specify which languages your project supports.
Example languages are ``C``, ``CXX`` (i.e. C++), ``Fortran``, etc.
By default ``C`` and ``CXX`` are enabled if no language options are
-given. Specify language ``NONE`` to skip enabling any languages.
+given. Specify language ``NONE``, or use the ``LANGUAGES`` keyword
+and list no languages, to skip enabling any languages.
If a variable exists called :variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE`,
the file pointed to by that variable will be included as the last step of the
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 11f9a76..1dcb72b 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -62,15 +62,33 @@ bool cmProjectCommand
"Value Computed by CMake", cmCacheManager::STATIC);
}
+ bool haveLanguages = false;
std::vector<std::string> languages;
- if(args.size() > 1)
+ for(size_t i = 1; i < args.size(); ++i)
{
- for(size_t i =1; i < args.size(); ++i)
+ if(args[i] == "LANGUAGES")
+ {
+ if(haveLanguages)
+ {
+ this->Makefile->IssueMessage
+ (cmake::FATAL_ERROR, "LANGUAGES may be specified at most once.");
+ cmSystemTools::SetFatalErrorOccured();
+ return true;
+ }
+ haveLanguages = true;
+ }
+ else
{
languages.push_back(args[i]);
}
}
- else
+
+ if (haveLanguages && languages.empty())
+ {
+ languages.push_back("NONE");
+ }
+
+ if (languages.empty())
{
// if no language is specified do c and c++
languages.push_back("C");
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 9646e67..c29b736 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -82,6 +82,7 @@ add_RunCMake_test(include)
add_RunCMake_test(include_directories)
add_RunCMake_test(list)
add_RunCMake_test(message)
+add_RunCMake_test(project)
add_RunCMake_test(string)
add_RunCMake_test(try_compile)
add_RunCMake_test(set)
diff --git a/Tests/RunCMake/project/CMakeLists.txt b/Tests/RunCMake/project/CMakeLists.txt
new file mode 100644
index 0000000..12cd3c7
--- /dev/null
+++ b/Tests/RunCMake/project/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.4)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/project/LanguagesEmpty-stdout.txt b/Tests/RunCMake/project/LanguagesEmpty-stdout.txt
new file mode 100644
index 0000000..fb9c7e8
--- /dev/null
+++ b/Tests/RunCMake/project/LanguagesEmpty-stdout.txt
@@ -0,0 +1 @@
+ENABLED_LANGUAGES='NONE'
diff --git a/Tests/RunCMake/project/LanguagesEmpty.cmake b/Tests/RunCMake/project/LanguagesEmpty.cmake
new file mode 100644
index 0000000..4de2cca
--- /dev/null
+++ b/Tests/RunCMake/project/LanguagesEmpty.cmake
@@ -0,0 +1,3 @@
+project(ProjectA LANGUAGES)
+get_property(langs GLOBAL PROPERTY ENABLED_LANGUAGES)
+message(STATUS "ENABLED_LANGUAGES='${langs}'")
diff --git a/Tests/RunCMake/project/LanguagesImplicit-stdout.txt b/Tests/RunCMake/project/LanguagesImplicit-stdout.txt
new file mode 100644
index 0000000..fb9c7e8
--- /dev/null
+++ b/Tests/RunCMake/project/LanguagesImplicit-stdout.txt
@@ -0,0 +1 @@
+ENABLED_LANGUAGES='NONE'
diff --git a/Tests/RunCMake/project/LanguagesImplicit.cmake b/Tests/RunCMake/project/LanguagesImplicit.cmake
new file mode 100644
index 0000000..e408454
--- /dev/null
+++ b/Tests/RunCMake/project/LanguagesImplicit.cmake
@@ -0,0 +1,3 @@
+project(ProjectA NONE)
+get_property(langs GLOBAL PROPERTY ENABLED_LANGUAGES)
+message(STATUS "ENABLED_LANGUAGES='${langs}'")
diff --git a/Tests/RunCMake/project/LanguagesNONE-stdout.txt b/Tests/RunCMake/project/LanguagesNONE-stdout.txt
new file mode 100644
index 0000000..fb9c7e8
--- /dev/null
+++ b/Tests/RunCMake/project/LanguagesNONE-stdout.txt
@@ -0,0 +1 @@
+ENABLED_LANGUAGES='NONE'
diff --git a/Tests/RunCMake/project/LanguagesNONE.cmake b/Tests/RunCMake/project/LanguagesNONE.cmake
new file mode 100644
index 0000000..2c0125f
--- /dev/null
+++ b/Tests/RunCMake/project/LanguagesNONE.cmake
@@ -0,0 +1,3 @@
+project(ProjectA LANGUAGES NONE)
+get_property(langs GLOBAL PROPERTY ENABLED_LANGUAGES)
+message(STATUS "ENABLED_LANGUAGES='${langs}'")
diff --git a/Tests/RunCMake/project/LanguagesTwice-result.txt b/Tests/RunCMake/project/LanguagesTwice-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/project/LanguagesTwice-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/project/LanguagesTwice-stderr.txt b/Tests/RunCMake/project/LanguagesTwice-stderr.txt
new file mode 100644
index 0000000..9c69dd0
--- /dev/null
+++ b/Tests/RunCMake/project/LanguagesTwice-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at LanguagesTwice.cmake:1 \(project\):
+ LANGUAGES may be specified at most once.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/project/LanguagesTwice.cmake b/Tests/RunCMake/project/LanguagesTwice.cmake
new file mode 100644
index 0000000..6c4a3dc
--- /dev/null
+++ b/Tests/RunCMake/project/LanguagesTwice.cmake
@@ -0,0 +1,2 @@
+project(ProjectA LANGUAGES NONE LANGUAGES)
+message("This line not reached.")
diff --git a/Tests/RunCMake/project/RunCMakeTest.cmake b/Tests/RunCMake/project/RunCMakeTest.cmake
new file mode 100644
index 0000000..cac0f46
--- /dev/null
+++ b/Tests/RunCMake/project/RunCMakeTest.cmake
@@ -0,0 +1,6 @@
+include(RunCMake)
+
+run_cmake(LanguagesImplicit)
+run_cmake(LanguagesEmpty)
+run_cmake(LanguagesNONE)
+run_cmake(LanguagesTwice)
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=00007dcc365797f71ebba2c7d31ab20abc4019e6
commit 00007dcc365797f71ebba2c7d31ab20abc4019e6
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Jan 29 09:00:40 2014 -0500
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Jan 29 09:15:20 2014 -0500
Help: Format project command and variable documentation
Also add document for CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE variable.
diff --git a/Help/command/project.rst b/Help/command/project.rst
index 9b9f93f..cb7d3fc 100644
--- a/Help/command/project.rst
+++ b/Help/command/project.rst
@@ -1,27 +1,31 @@
project
-------
-Set a name for the entire project.
+Set a name and enable languages for the entire project.
-::
+.. code-block:: cmake
- project(<projectname> [languageName1 languageName2 ... ] )
+ project(<PROJECT-NAME> [<language-name>...])
-Sets the name of the project. Additionally this sets the variables
-<projectName>_BINARY_DIR and <projectName>_SOURCE_DIR to the
-respective values.
+Sets the name of the project and stores the name in the
+:variable:`PROJECT_NAME` variable. Additionally this sets variables
+
+* :variable:`PROJECT_SOURCE_DIR`,
+ :variable:`<PROJECT-NAME>_SOURCE_DIR`
+* :variable:`PROJECT_BINARY_DIR`,
+ :variable:`<PROJECT-NAME>_BINARY_DIR`
Optionally you can specify which languages your project supports.
-Example languages are CXX (i.e. C++), C, Fortran, etc. By default C
-and CXX are enabled. E.g. if you do not have a C++ compiler, you can
-disable the check for it by explicitly listing the languages you want
-to support, e.g. C. By using the special language "NONE" all checks
-for any language can be disabled. If a variable exists called
-CMAKE_PROJECT_<projectName>_INCLUDE, the file pointed to by that
-variable will be included as the last step of the project command.
-
-The top-level CMakeLists.txt file for a project must contain a
-literal, direct call to the project() command; loading one through the
-include() command is not sufficient. If no such call exists CMake
-will implicitly add one to the top that enables the default languages
-(C and CXX).
+Example languages are ``C``, ``CXX`` (i.e. C++), ``Fortran``, etc.
+By default ``C`` and ``CXX`` are enabled if no language options are
+given. Specify language ``NONE`` to skip enabling any languages.
+
+If a variable exists called :variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE`,
+the file pointed to by that variable will be included as the last step of the
+project command.
+
+The top-level ``CMakeLists.txt`` file for a project must contain a
+literal, direct call to the :command:`project` command; loading one
+through the :command:`include` command is not sufficient. If no such
+call exists CMake will implicitly add one to the top that enables the
+default languages (``C`` and ``CXX``).
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 832bd99..f363f94 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -121,6 +121,7 @@ Variables that Change Behavior
/variable/CMAKE_POLICY_DEFAULT_CMPNNNN
/variable/CMAKE_PREFIX_PATH
/variable/CMAKE_PROGRAM_PATH
+ /variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE
/variable/CMAKE_SKIP_INSTALL_ALL_DEPENDENCY
/variable/CMAKE_STAGING_PREFIX
/variable/CMAKE_SYSTEM_IGNORE_PATH
diff --git a/Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE.rst b/Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE.rst
new file mode 100644
index 0000000..ba9df5a
--- /dev/null
+++ b/Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE.rst
@@ -0,0 +1,6 @@
+CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE
+------------------------------------
+
+A CMake language file or module to be included by the :command:`project`
+command. This is is intended for injecting custom code into project
+builds without modifying their source.
diff --git a/Help/variable/PROJECT-NAME_BINARY_DIR.rst b/Help/variable/PROJECT-NAME_BINARY_DIR.rst
index a19940f..49bc558 100644
--- a/Help/variable/PROJECT-NAME_BINARY_DIR.rst
+++ b/Help/variable/PROJECT-NAME_BINARY_DIR.rst
@@ -3,6 +3,6 @@
Top level binary directory for the named project.
-A variable is created with the name used in the PROJECT command, and
-is the binary directory for the project. This can be useful when
-SUBDIR is used to connect several projects.
+A variable is created with the name used in the :command:`project` command,
+and is the binary directory for the project. This can be useful when
+:command:`add_subdirectory` is used to connect several projects.
diff --git a/Help/variable/PROJECT-NAME_SOURCE_DIR.rst b/Help/variable/PROJECT-NAME_SOURCE_DIR.rst
index f2f5caf..4df3e22 100644
--- a/Help/variable/PROJECT-NAME_SOURCE_DIR.rst
+++ b/Help/variable/PROJECT-NAME_SOURCE_DIR.rst
@@ -3,6 +3,6 @@
Top level source directory for the named project.
-A variable is created with the name used in the PROJECT command, and
-is the source directory for the project. This can be useful when
-add_subdirectory is used to connect several projects.
+A variable is created with the name used in the :command:`project` command,
+and is the source directory for the project. This can be useful when
+:command:`add_subdirectory` is used to connect several projects.
diff --git a/Help/variable/PROJECT_BINARY_DIR.rst b/Help/variable/PROJECT_BINARY_DIR.rst
index e506bdd..09e9ef2 100644
--- a/Help/variable/PROJECT_BINARY_DIR.rst
+++ b/Help/variable/PROJECT_BINARY_DIR.rst
@@ -3,4 +3,4 @@ PROJECT_BINARY_DIR
Full path to build directory for project.
-This is the binary directory of the most recent PROJECT command.
+This is the binary directory of the most recent :command:`project` command.
diff --git a/Help/variable/PROJECT_NAME.rst b/Help/variable/PROJECT_NAME.rst
index 7559af6..61aa8bc 100644
--- a/Help/variable/PROJECT_NAME.rst
+++ b/Help/variable/PROJECT_NAME.rst
@@ -3,4 +3,4 @@ PROJECT_NAME
Name of the project given to the project command.
-This is the name given to the most recent PROJECT command.
+This is the name given to the most recent :command:`project` command.
diff --git a/Help/variable/PROJECT_SOURCE_DIR.rst b/Help/variable/PROJECT_SOURCE_DIR.rst
index c9ba132..27f2838 100644
--- a/Help/variable/PROJECT_SOURCE_DIR.rst
+++ b/Help/variable/PROJECT_SOURCE_DIR.rst
@@ -3,4 +3,4 @@ PROJECT_SOURCE_DIR
Top level source directory for the current project.
-This is the source directory of the most recent PROJECT command.
+This is the source directory of the most recent :command:`project` command.
-----------------------------------------------------------------------
Summary of changes:
Help/command/project.rst | 68 ++++++---
Help/manual/cmake-policies.7.rst | 1 +
Help/manual/cmake-variables.7.rst | 11 ++
Help/policy/CMP0048.rst | 22 +++
.../CMAKE_PROJECT_PROJECT-NAME_INCLUDE.rst | 6 +
Help/variable/PROJECT-NAME_BINARY_DIR.rst | 6 +-
Help/variable/PROJECT-NAME_SOURCE_DIR.rst | 6 +-
Help/variable/PROJECT-NAME_VERSION.rst | 11 ++
Help/variable/PROJECT-NAME_VERSION_MAJOR.rst | 5 +
Help/variable/PROJECT-NAME_VERSION_MINOR.rst | 5 +
Help/variable/PROJECT-NAME_VERSION_PATCH.rst | 5 +
Help/variable/PROJECT-NAME_VERSION_TWEAK.rst | 5 +
Help/variable/PROJECT_BINARY_DIR.rst | 2 +-
Help/variable/PROJECT_NAME.rst | 2 +-
Help/variable/PROJECT_SOURCE_DIR.rst | 2 +-
Help/variable/PROJECT_VERSION.rst | 11 ++
Help/variable/PROJECT_VERSION_MAJOR.rst | 5 +
Help/variable/PROJECT_VERSION_MINOR.rst | 5 +
Help/variable/PROJECT_VERSION_PATCH.rst | 5 +
Help/variable/PROJECT_VERSION_TWEAK.rst | 5 +
Modules/CMakePackageConfigHelpers.cmake | 5 +-
Modules/WriteBasicConfigVersionFile.cmake | 8 +-
Source/cmPolicies.cxx | 5 +
Source/cmPolicies.h | 1 +
Source/cmProjectCommand.cxx | 159 +++++++++++++++++++-
Tests/RunCMake/CMakeLists.txt | 1 +
.../CMP0048-NEW-stderr.txt} | 0
Tests/RunCMake/project/CMP0048-NEW-stdout.txt | 30 ++++
Tests/RunCMake/project/CMP0048-NEW.cmake | 19 +++
.../CMP0048-OLD-VERSION-result.txt} | 0
.../project/CMP0048-OLD-VERSION-stderr.txt | 4 +
Tests/RunCMake/project/CMP0048-OLD-VERSION.cmake | 2 +
Tests/RunCMake/project/CMP0048-OLD-stdout.txt | 2 +
Tests/RunCMake/project/CMP0048-OLD.cmake | 6 +
Tests/RunCMake/project/CMP0048-WARN-stderr.txt | 12 ++
Tests/RunCMake/project/CMP0048-WARN.cmake | 3 +
Tests/RunCMake/{CMP0004 => project}/CMakeLists.txt | 0
Tests/RunCMake/project/LanguagesEmpty-stdout.txt | 1 +
Tests/RunCMake/project/LanguagesEmpty.cmake | 3 +
.../RunCMake/project/LanguagesImplicit-stdout.txt | 1 +
Tests/RunCMake/project/LanguagesImplicit.cmake | 3 +
Tests/RunCMake/project/LanguagesNONE-stdout.txt | 1 +
Tests/RunCMake/project/LanguagesNONE.cmake | 3 +
.../LanguagesTwice-result.txt} | 0
Tests/RunCMake/project/LanguagesTwice-stderr.txt | 4 +
Tests/RunCMake/project/LanguagesTwice.cmake | 2 +
Tests/RunCMake/project/RunCMakeTest.cmake | 17 +++
.../project/VersionAndLanguagesEmpty-stdout.txt | 2 +
.../project/VersionAndLanguagesEmpty.cmake | 5 +
Tests/RunCMake/project/VersionEmpty-stdout.txt | 2 +
Tests/RunCMake/project/VersionEmpty.cmake | 6 +
.../VersionInvalid-result.txt} | 0
Tests/RunCMake/project/VersionInvalid-stderr.txt | 4 +
Tests/RunCMake/project/VersionInvalid.cmake | 3 +
.../VersionMissingLanguages-result.txt} | 0
.../project/VersionMissingLanguages-stderr.txt | 4 +
.../RunCMake/project/VersionMissingLanguages.cmake | 3 +
.../project/VersionMissingValueOkay-stdout.txt | 2 +
.../RunCMake/project/VersionMissingValueOkay.cmake | 6 +
.../VersionTwice-result.txt} | 0
Tests/RunCMake/project/VersionTwice-stderr.txt | 4 +
Tests/RunCMake/project/VersionTwice.cmake | 3 +
62 files changed, 490 insertions(+), 34 deletions(-)
create mode 100644 Help/policy/CMP0048.rst
create mode 100644 Help/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE.rst
create mode 100644 Help/variable/PROJECT-NAME_VERSION.rst
create mode 100644 Help/variable/PROJECT-NAME_VERSION_MAJOR.rst
create mode 100644 Help/variable/PROJECT-NAME_VERSION_MINOR.rst
create mode 100644 Help/variable/PROJECT-NAME_VERSION_PATCH.rst
create mode 100644 Help/variable/PROJECT-NAME_VERSION_TWEAK.rst
create mode 100644 Help/variable/PROJECT_VERSION.rst
create mode 100644 Help/variable/PROJECT_VERSION_MAJOR.rst
create mode 100644 Help/variable/PROJECT_VERSION_MINOR.rst
create mode 100644 Help/variable/PROJECT_VERSION_PATCH.rst
create mode 100644 Help/variable/PROJECT_VERSION_TWEAK.rst
copy Tests/RunCMake/{CMP0022/CMP0022-NOWARN-exe-stderr.txt => project/CMP0048-NEW-stderr.txt} (100%)
create mode 100644 Tests/RunCMake/project/CMP0048-NEW-stdout.txt
create mode 100644 Tests/RunCMake/project/CMP0048-NEW.cmake
copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => project/CMP0048-OLD-VERSION-result.txt} (100%)
create mode 100644 Tests/RunCMake/project/CMP0048-OLD-VERSION-stderr.txt
create mode 100644 Tests/RunCMake/project/CMP0048-OLD-VERSION.cmake
create mode 100644 Tests/RunCMake/project/CMP0048-OLD-stdout.txt
create mode 100644 Tests/RunCMake/project/CMP0048-OLD.cmake
create mode 100644 Tests/RunCMake/project/CMP0048-WARN-stderr.txt
create mode 100644 Tests/RunCMake/project/CMP0048-WARN.cmake
copy Tests/RunCMake/{CMP0004 => project}/CMakeLists.txt (100%)
create mode 100644 Tests/RunCMake/project/LanguagesEmpty-stdout.txt
create mode 100644 Tests/RunCMake/project/LanguagesEmpty.cmake
create mode 100644 Tests/RunCMake/project/LanguagesImplicit-stdout.txt
create mode 100644 Tests/RunCMake/project/LanguagesImplicit.cmake
create mode 100644 Tests/RunCMake/project/LanguagesNONE-stdout.txt
create mode 100644 Tests/RunCMake/project/LanguagesNONE.cmake
copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => project/LanguagesTwice-result.txt} (100%)
create mode 100644 Tests/RunCMake/project/LanguagesTwice-stderr.txt
create mode 100644 Tests/RunCMake/project/LanguagesTwice.cmake
create mode 100644 Tests/RunCMake/project/RunCMakeTest.cmake
create mode 100644 Tests/RunCMake/project/VersionAndLanguagesEmpty-stdout.txt
create mode 100644 Tests/RunCMake/project/VersionAndLanguagesEmpty.cmake
create mode 100644 Tests/RunCMake/project/VersionEmpty-stdout.txt
create mode 100644 Tests/RunCMake/project/VersionEmpty.cmake
copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => project/VersionInvalid-result.txt} (100%)
create mode 100644 Tests/RunCMake/project/VersionInvalid-stderr.txt
create mode 100644 Tests/RunCMake/project/VersionInvalid.cmake
copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => project/VersionMissingLanguages-result.txt} (100%)
create mode 100644 Tests/RunCMake/project/VersionMissingLanguages-stderr.txt
create mode 100644 Tests/RunCMake/project/VersionMissingLanguages.cmake
create mode 100644 Tests/RunCMake/project/VersionMissingValueOkay-stdout.txt
create mode 100644 Tests/RunCMake/project/VersionMissingValueOkay.cmake
copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => project/VersionTwice-result.txt} (100%)
create mode 100644 Tests/RunCMake/project/VersionTwice-stderr.txt
create mode 100644 Tests/RunCMake/project/VersionTwice.cmake
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list