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  78532d6e3eb87c2a479fcae496006a72853f0f27 (commit)
       via  047d35d355669f9f568a28e3d4df1c7c11b565e8 (commit)
       via  6ef75f436bba6017d80a1bbd32dcfba689ec2fd6 (commit)
       via  7bb7474c2da42863639975eff81f60bfd3578b69 (commit)
       via  0569b189d9091d313944b3bdc9487c2bd583a7aa (commit)
       via  d59997264dd5f431dbf64efcae253942544d0d16 (commit)
       via  4401326286dcb908ae1b2f5c3f1d304f61dbc5b6 (commit)
      from  3c6550c49c5b8a99e1af5effd2c6bb978e9c517f (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=78532d6e3eb87c2a479fcae496006a72853f0f27
commit 78532d6e3eb87c2a479fcae496006a72853f0f27
Merge: 3c6550c 047d35d
Author:     Alexander Neundorf <neund...@kde.org>
AuthorDate: Sat Jan 25 16:17:28 2014 -0500
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Sat Jan 25 16:17:28 2014 -0500

    Merge topic 'AddVersionToProjectCommand' into next
    
    047d35d3 project(): add test for VERSION parameter
    6ef75f43 write_basic_package_version_file(): make use of the new 
${PROJECT_VERSION}
    7bb7474c project(): document the new VERSION argument
    0569b189 project(): improve documentation
    d5999726 project(): unset VERSION variables if no VERSION is given
    44013262 project(): add optional VERSION argument


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=047d35d355669f9f568a28e3d4df1c7c11b565e8
commit 047d35d355669f9f568a28e3d4df1c7c11b565e8
Author:     Alex Neundorf <neund...@kde.org>
AuthorDate: Fri Jan 10 23:29:16 2014 +0100
Commit:     Alex Neundorf <neund...@kde.org>
CommitDate: Sat Jan 25 21:19:04 2014 +0100

    project(): add test for VERSION parameter
    
    Alex

diff --git a/Tests/DoubleProject/CMakeLists.txt 
b/Tests/DoubleProject/CMakeLists.txt
index 02a6275..c9004eb 100644
--- a/Tests/DoubleProject/CMakeLists.txt
+++ b/Tests/DoubleProject/CMakeLists.txt
@@ -1,3 +1,56 @@
 project(dumb)
 project(dumber)
 add_executable(just_silly silly.c)
+
+if(DEFINED PROJECT_VERSION)
+  message(SEND_ERROR "PROJECT_VERSION defined, but should not !")
+endif()
+
+project(Foo VERSION "1.2.3.4" C)
+
+if(NOT Foo_VERSION STREQUAL "1.2.3.4")
+  message(SEND_ERROR "Foo_VERSION set to ${Foo_VERSION} ! (expected 1.2.3.4 !")
+endif()
+
+if(NOT 
"${Foo_VERSION_MAJOR}.${Foo_VERSION_MINOR}.${Foo_VERSION_PATCH}.${Foo_VERSION_TWEAK}"
 STREQUAL "1.2.3.4")
+  message(SEND_ERROR "Foo_VERSION set to 
\"${Foo_VERSION_MAJOR}.${Foo_VERSION_MINOR}.${Foo_VERSION_PATCH}.${Foo_VERSION_TWEAK}\"!
 (expected 1.2.3.4 !")
+endif()
+
+if(NOT Foo_VERSION STREQUAL PROJECT_VERSION)
+  message(SEND_ERROR "Foo_VERSION differs from PROJECT_VERSION ! 
(${Foo_VERSION} != ${PROJECT_VERSION})")
+endif()
+
+project(Bar CXX)
+
+if(DEFINED PROJECT_VERSION)
+  message(SEND_ERROR "PROJECT_VERSION defined (\"${PROJECT_VERSION}\"), but 
should not !")
+endif()
+
+if(DEFINED Bar_VERSION)
+  message(SEND_ERROR "Bar_VERSION defined, but should not !")
+endif()
+
+
+# test that PROJECT_VERSION is not reset if it hasn't been set by 
project(VERSION)
+
+set(PROJECT_VERSION "5.6.7")
+
+project(Blub)
+
+if(NOT "${PROJECT_VERSION}" STREQUAL "5.6.7")
+  message(SEND_ERROR "PROJECT_VERSION unset, but should not have been unset 
since it wasn't set by project(VERSION) before.")
+endif()
+
+
+
+project(Xyz VERSION "7.8.9")
+
+set(CMAKE_PROJECT_VERSION_SET_BY_PROJECT_COMMAND FALSE)
+
+set(PROJECT_VERSION "3.2.1")
+
+project(Abc)
+
+if(NOT "${PROJECT_VERSION}" STREQUAL "3.2.1")
+  message(SEND_ERROR "PROJECT_VERSION set to \"${PROJECT_VERSION}\", but 
should still be 3.2.1, since unsetting was disabled .")
+endif()

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6ef75f436bba6017d80a1bbd32dcfba689ec2fd6
commit 6ef75f436bba6017d80a1bbd32dcfba689ec2fd6
Author:     Alex Neundorf <neund...@kde.org>
AuthorDate: Mon Jan 6 21:20:44 2014 +0100
Commit:     Alex Neundorf <neund...@kde.org>
CommitDate: Sat Jan 25 21:19:04 2014 +0100

    write_basic_package_version_file(): make use of the new ${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..210fdb1 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 version number specified via
+# project(... VERSION x.y.z ...) 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=7bb7474c2da42863639975eff81f60bfd3578b69
commit 7bb7474c2da42863639975eff81f60bfd3578b69
Author:     Alex Neundorf <neund...@kde.org>
AuthorDate: Mon Jan 6 21:20:12 2014 +0100
Commit:     Alex Neundorf <neund...@kde.org>
CommitDate: Sat Jan 25 21:19:04 2014 +0100

    project(): document the new VERSION argument
    
    Alex

diff --git a/Help/command/project.rst b/Help/command/project.rst
index 41cecd3..04c953e 100644
--- a/Help/command/project.rst
+++ b/Help/command/project.rst
@@ -5,7 +5,7 @@ Set a name for the entire project.
 
 ::
 
-  project(<projectname> [languageName1 languageName2 ... ] )
+  project(<projectname> [VERSION major[.minor[.patch[.tweak]]]] [languageName1 
languageName2 ... ] )
 
 Sets the name of the project, the name is also stored in the PROJECT_NAME
 variable.  Additionally this sets the cache variables
@@ -13,6 +13,17 @@ variable.  Additionally this sets the cache variables
 respective values, as well as the PROJECT_BINARY_DIR and PROJECT_SOURCE_DIR
 variables.
 
+If a version is specified, the :command:`project()` command sets the variables
+PROJECT_VERSION and <projectName>_VERSION to this version.
+Additionally the up to 4 components of the version string are stored in the
+PROJECT_VERSION_MAJOR, PROJECT_VERSION_MINOR, PROJECT_VERSION_PATCH and
+PROJECT_VERSION_TWEAK, as well as the <projectName>_VERSION_MAJOR,
+<projectName>_VERSION_MINOR, <projectName>_VERSION_PATCH> and
+<projectName>_VERSION_TWEAK variables.
+If VERSION is not used, the PROJECT_VERSION variables will be unset if they
+have been set by a :command:`project(VERSION)` call before. This can be 
disabled
+by setting the variable CMAKE_PROJECT_VERSION_SET_BY_PROJECT_COMMAND to FALSE.
+
 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

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0569b189d9091d313944b3bdc9487c2bd583a7aa
commit 0569b189d9091d313944b3bdc9487c2bd583a7aa
Author:     Alex Neundorf <neund...@kde.org>
AuthorDate: Mon Jan 6 21:19:44 2014 +0100
Commit:     Alex Neundorf <neund...@kde.org>
CommitDate: Sat Jan 25 21:19:03 2014 +0100

    project(): improve documentation
    
    Now also mention PROJECT_NAME, PROJECT_SOURCE_DIR and PROJECT_BINARY_DIR
    in the documentation for project().
    
    Alex

diff --git a/Help/command/project.rst b/Help/command/project.rst
index 9b9f93f..41cecd3 100644
--- a/Help/command/project.rst
+++ b/Help/command/project.rst
@@ -7,9 +7,11 @@ Set a name for the entire project.
 
   project(<projectname> [languageName1 languageName2 ... ] )
 
-Sets the name of the project.  Additionally this sets the variables
+Sets the name of the project, the name is also stored in the PROJECT_NAME
+variable.  Additionally this sets the cache variables
 <projectName>_BINARY_DIR and <projectName>_SOURCE_DIR to the
-respective values.
+respective values, as well as the PROJECT_BINARY_DIR and PROJECT_SOURCE_DIR
+variables.
 
 Optionally you can specify which languages your project supports.
 Example languages are CXX (i.e.  C++), C, Fortran, etc.  By default C

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d59997264dd5f431dbf64efcae253942544d0d16
commit d59997264dd5f431dbf64efcae253942544d0d16
Author:     Alex Neundorf <neund...@kde.org>
AuthorDate: Fri Jan 10 22:05:11 2014 +0100
Commit:     Alex Neundorf <neund...@kde.org>
CommitDate: Sat Jan 25 21:19:03 2014 +0100

    project(): unset VERSION variables if no VERSION is given
    
    By unsetting the VERSION variables, it is ensured that in subdirs
    with project()-calls without version not accidentially the VERSION
    from parent directories is inherited. But only unset these variables
    if they have been set by a previous project() call. This is done by
    testing the cmake variable CMAKE_PROJECT_VERSION_SET_BY_PROJECT_COMMAND.
    
    Alex

diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 811813c..8a851e0 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -62,6 +62,7 @@ bool cmProjectCommand
        "Value Computed by CMake", cmCacheManager::STATIC);
     }
 
+  bool haveVersion = false;
   std::string version;
   std::vector<std::string> languages;
   bool doingVersion = false;
@@ -70,6 +71,7 @@ bool cmProjectCommand
     if (doingVersion)
       {
       doingVersion = false;
+      haveVersion = true;
       version = args[i];
       }
     else
@@ -85,7 +87,38 @@ bool cmProjectCommand
       }
     }
 
-  if (version.size() > 0)
+  if (version.empty())
+    {
+    if (this->Makefile->IsOn("CMAKE_PROJECT_VERSION_SET_BY_PROJECT_COMMAND"))
+      {
+      // unset these variables only if they have been set by a previous
+      // project() call
+      this->Makefile->RemoveDefinition("PROJECT_VERSION");
+      this->Makefile->RemoveDefinition("PROJECT_VERSION_MAJOR");
+      this->Makefile->RemoveDefinition("PROJECT_VERSION_MINOR");
+      this->Makefile->RemoveDefinition("PROJECT_VERSION_PATCH");
+      this->Makefile->RemoveDefinition("PROJECT_VERSION_TWEAK");
+      }
+
+    if (haveVersion)
+      {
+      // an empty version has been explicitely set
+      std::string versionVar = args[0] + "_VERSION";
+      this->Makefile->RemoveDefinition(versionVar.c_str());
+      versionVar = args[0] + "_VERSION_MAJOR";
+      this->Makefile->RemoveDefinition(versionVar.c_str());
+      versionVar = args[0] + "_VERSION_MINOR";
+      this->Makefile->RemoveDefinition(versionVar.c_str());
+      versionVar = args[0] + "_VERSION_PATCH";
+      this->Makefile->RemoveDefinition(versionVar.c_str());
+      versionVar = args[0] + "_VERSION_TWEAK";
+      this->Makefile->RemoveDefinition(versionVar.c_str());
+      }
+
+    this->Makefile->RemoveDefinition(
+                               "CMAKE_PROJECT_VERSION_SET_BY_PROJECT_COMMAND");
+    }
+  else
     {
     // A version was set, set the variables.
     unsigned int versionMajor = 0;
@@ -97,27 +130,23 @@ bool cmProjectCommand
                               &versionPatch, &versionTweak);
 
     char buffer[1024];
-
-    std::string versionVar = args[0];
-    versionVar += "_VERSION_TWEAK";
+    std::string versionVar;
+    versionVar = args[0] + "_VERSION_TWEAK";
     sprintf(buffer, "%d", versionCount >=4 ? versionTweak : 0);
     this->Makefile->AddDefinition("PROJECT_VERSION_TWEAK", buffer);
     this->Makefile->AddDefinition(versionVar.c_str(), buffer);
 
-    versionVar = args[0];
-    versionVar += "_VERSION_PATCH";
+    versionVar = args[0] + "_VERSION_PATCH";
     sprintf(buffer, "%d", versionCount >=3 ? versionPatch : 0);
     this->Makefile->AddDefinition("PROJECT_VERSION_PATCH", buffer);
     this->Makefile->AddDefinition(versionVar.c_str(), buffer);
 
-    versionVar = args[0];
-    versionVar += "_VERSION_MINOR";
+    versionVar = args[0] + "_VERSION_MINOR";
     sprintf(buffer, "%d", versionCount >=2 ? versionMinor : 0);
     this->Makefile->AddDefinition("PROJECT_VERSION_MINOR", buffer);
     this->Makefile->AddDefinition(versionVar.c_str(), buffer);
 
-    versionVar = args[0];
-    versionVar += "_VERSION_MAJOR";
+    versionVar = args[0] + "_VERSION_MAJOR";
     sprintf(buffer, "%d", versionCount >=1 ? versionMajor : 0);
     this->Makefile->AddDefinition("PROJECT_VERSION_MAJOR", buffer);
     this->Makefile->AddDefinition(versionVar.c_str(), buffer);
@@ -146,6 +175,9 @@ bool cmProjectCommand
     versionVar += "_VERSION";
     this->Makefile->AddDefinition("PROJECT_VERSION", buffer);
     this->Makefile->AddDefinition(versionVar.c_str(), buffer);
+
+    this->Makefile->AddDefinition(
+                       "CMAKE_PROJECT_VERSION_SET_BY_PROJECT_COMMAND", "TRUE");
   }
 
   if (languages.size() == 0)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4401326286dcb908ae1b2f5c3f1d304f61dbc5b6
commit 4401326286dcb908ae1b2f5c3f1d304f61dbc5b6
Author:     Alex Neundorf <neund...@kde.org>
AuthorDate: Mon Jan 6 21:18:58 2014 +0100
Commit:     Alex Neundorf <neund...@kde.org>
CommitDate: Mon Jan 6 21:22:43 2014 +0100

    project(): add optional VERSION argument
    
    This patch adds support for an optional VERSION
    argument to project().
    With this patch, project() now also sets
    PROJECT_VERSION_(MAJOR|MINOR|PATCH|TWEAK) and
    <Name>_VERSION_(MAJOR|MINOR|PATCH|TWEAK) variables.
    This makes it possible for other functions or macros
    to rely on these variables containing the version number
    of the current project.
    
    Alex

diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 11f9a76..811813c 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -62,15 +62,93 @@ bool cmProjectCommand
        "Value Computed by CMake", cmCacheManager::STATIC);
     }
 
+  std::string version;
   std::vector<std::string> languages;
-  if(args.size() > 1)
+  bool doingVersion = false;
+  for(size_t i =1; i < args.size(); ++i)
     {
-    for(size_t i =1; i < args.size(); ++i)
+    if (doingVersion)
       {
-      languages.push_back(args[i]);
+      doingVersion = false;
+      version = args[i];
       }
+    else
+      {
+      if (args[i] == "VERSION")
+        {
+        doingVersion = true;
+        }
+      else
+        {
+        languages.push_back(args[i]);
+        }
+      }
+    }
+
+  if (version.size() > 0)
+    {
+    // A version was set, set the variables.
+    unsigned int versionMajor = 0;
+    unsigned int versionMinor = 0;
+    unsigned int versionPatch = 0;
+    unsigned int versionTweak= 0;
+    int versionCount = sscanf(version.c_str(), "%u.%u.%u.%u",
+                              &versionMajor, &versionMinor,
+                              &versionPatch, &versionTweak);
+
+    char buffer[1024];
+
+    std::string versionVar = args[0];
+    versionVar += "_VERSION_TWEAK";
+    sprintf(buffer, "%d", versionCount >=4 ? versionTweak : 0);
+    this->Makefile->AddDefinition("PROJECT_VERSION_TWEAK", buffer);
+    this->Makefile->AddDefinition(versionVar.c_str(), buffer);
+
+    versionVar = args[0];
+    versionVar += "_VERSION_PATCH";
+    sprintf(buffer, "%d", versionCount >=3 ? versionPatch : 0);
+    this->Makefile->AddDefinition("PROJECT_VERSION_PATCH", buffer);
+    this->Makefile->AddDefinition(versionVar.c_str(), buffer);
+
+    versionVar = args[0];
+    versionVar += "_VERSION_MINOR";
+    sprintf(buffer, "%d", versionCount >=2 ? versionMinor : 0);
+    this->Makefile->AddDefinition("PROJECT_VERSION_MINOR", buffer);
+    this->Makefile->AddDefinition(versionVar.c_str(), buffer);
+
+    versionVar = args[0];
+    versionVar += "_VERSION_MAJOR";
+    sprintf(buffer, "%d", versionCount >=1 ? versionMajor : 0);
+    this->Makefile->AddDefinition("PROJECT_VERSION_MAJOR", buffer);
+    this->Makefile->AddDefinition(versionVar.c_str(), buffer);
+
+    switch(versionCount)
+    {
+      case 4:
+        sprintf(buffer, "%d.%d.%d.%d",
+                versionMajor, versionMinor, versionPatch, versionTweak);
+        break;
+      case 3:
+        sprintf(buffer, "%d.%d.%d", versionMajor, versionMinor, versionPatch);
+        break;
+      case 2:
+        sprintf(buffer, "%d.%d", versionMajor, versionMinor);
+        break;
+      case 1:
+        sprintf(buffer, "%d", versionMajor);
+        break;
+      case 0:
+        sprintf(buffer, "0");
+        break;
     }
-  else
+
+    versionVar = args[0];
+    versionVar += "_VERSION";
+    this->Makefile->AddDefinition("PROJECT_VERSION", buffer);
+    this->Makefile->AddDefinition(versionVar.c_str(), buffer);
+  }
+
+  if (languages.size() == 0)
     {
     // if no language is specified do c and c++
     languages.push_back("C");

-----------------------------------------------------------------------

Summary of changes:
 Help/command/project.rst                  |   19 ++++-
 Modules/CMakePackageConfigHelpers.cmake   |    5 +-
 Modules/WriteBasicConfigVersionFile.cmake |    8 +-
 Source/cmProjectCommand.cxx               |  116 ++++++++++++++++++++++++++++-
 Tests/DoubleProject/CMakeLists.txt        |   53 +++++++++++++
 5 files changed, 192 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits

Reply via email to