cmVersion.cxx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #include "cmVersion.h"
  14. std::string cmVersion::GetReleaseVersion()
  15. {
  16. #if CMake_VERSION_MINOR & 1
  17. std::string cver = "Date: 2007-01-15 01:10:45 +0000";
  18. std::string res = "";
  19. std::string::size_type cc, len = cver.size();
  20. bool aftercol = false;
  21. int cnt = 0;
  22. for ( cc = 0; cc < len; cc ++ )
  23. {
  24. if ( aftercol )
  25. {
  26. char ch = cver[cc];
  27. switch ( ch )
  28. {
  29. case ' ':
  30. case ':':
  31. case '/':
  32. case '-':
  33. case '$':
  34. break;
  35. default:
  36. res += ch;
  37. cnt ++;
  38. }
  39. if ( cnt >= 8 )
  40. {
  41. return res;
  42. }
  43. }
  44. else
  45. {
  46. if ( cver[cc] == ':' )
  47. {
  48. aftercol = true;
  49. }
  50. }
  51. }
  52. return res;
  53. #else
  54. # if CMake_VERSION_PATCH == 1
  55. return "1-beta";
  56. # else
  57. # ifdef CMake_VERSION_RC
  58. return "patch " CMAKE_TO_STRING(CMake_VERSION_PATCH) " RC-"
  59. CMAKE_TO_STRING(CMake_VERSION_RC);
  60. # else
  61. return "patch " CMAKE_TO_STRING(CMake_VERSION_PATCH);
  62. # endif
  63. # endif
  64. #endif
  65. }
  66. std::string cmVersion::GetCMakeVersion()
  67. {
  68. cmOStringStream str;
  69. str << CMake_VERSION_MAJOR << "." << CMake_VERSION_MINOR
  70. << "-"
  71. << cmVersion::GetReleaseVersion();
  72. return str.str();
  73. }