You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.5 KiB

  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Insight Consortium. All rights reserved.
  8. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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 "cmCMakeMinimumRequired.h"
  14. #include "stdio.h"
  15. // cmCMakeMinimumRequired
  16. bool cmCMakeMinimumRequired::InitialPass(std::vector<std::string> const& args)
  17. {
  18. if(args.size() != 2)
  19. {
  20. this->SetError("called with incorrect number of arguments");
  21. return false;
  22. }
  23. if(args[0] == "VERSION")
  24. {
  25. m_Makefile->AddDefinition("CMAKE_MINIMUM_REQUIRED_VERSION", args[1].c_str());
  26. }
  27. float version = float(m_Makefile->GetMajorVersion());
  28. version += (float(m_Makefile->GetMinorVersion()) * (float).1);
  29. float reqVersion = 0;
  30. sscanf(args[1].c_str(), "%f", &reqVersion);
  31. if(reqVersion > version)
  32. {
  33. cmStringStream str;
  34. str << "WARNING: This project requires version: " << args[1].c_str() << " of cmake.\n"
  35. << "You are running version: " << version;
  36. cmSystemTools::Message(str.str().c_str());
  37. }
  38. return true;
  39. }