cmVersion.cxx 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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: 2005-04-12 07:09:59 +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 == 0
  55. return "beta";
  56. # else
  57. return "patch " CMAKE_TO_STRING(CMake_VERSION_PATCH);
  58. # endif
  59. #endif
  60. }
  61. std::string cmVersion::GetCMakeVersion()
  62. {
  63. cmOStringStream str;
  64. str << CMake_VERSION_MAJOR << "." << CMake_VERSION_MINOR
  65. << "-"
  66. << cmVersion::GetReleaseVersion();
  67. return str.str();
  68. }