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.

80 lines
2.6 KiB

25 years ago
25 years ago
25 years ago
25 years ago
22 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
  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 "cmWrapExcludeFilesCommand.h"
  14. #include "cmSourceFile.h"
  15. #include <stdlib.h> // required for atof
  16. // cmWrapExcludeFilesCommand
  17. bool cmWrapExcludeFilesCommand::InitialPass(std::vector<std::string> const& argsIn)
  18. {
  19. const char* versionValue
  20. = m_Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
  21. if (versionValue && atof(versionValue) > 1.2)
  22. {
  23. this->SetError("The WRAP_EXCLUDE_FILES command has been deprecated in CMake version 1.4. You should use the SET_SOURCE_FILES_PROPERTIES command instead.\n");
  24. return false;
  25. }
  26. if(argsIn.size() < 1 )
  27. {
  28. this->SetError("called with incorrect number of arguments");
  29. return false;
  30. }
  31. std::vector<std::string> args;
  32. m_Makefile->ExpandSourceListArguments(argsIn, args, 0);
  33. for(std::vector<std::string>::const_iterator j = args.begin();
  34. j != args.end(); ++j)
  35. {
  36. // if the file is already in the makefile just set properites on it
  37. cmSourceFile* sf = m_Makefile->GetSource(j->c_str());
  38. if(sf)
  39. {
  40. sf->SetProperty("WRAP_EXCLUDE","1");
  41. }
  42. // if file is not already in the makefile, then add it
  43. else
  44. {
  45. std::string newfile = *j;
  46. cmSourceFile file;
  47. std::string path = cmSystemTools::GetFilenamePath(newfile);
  48. // set the flags
  49. file.SetProperty("WRAP_EXCLUDE","1");
  50. // if this is a full path then
  51. if((path.size() && path[0] == '/') ||
  52. (path.size() > 1 && path[1] == ':'))
  53. {
  54. file.SetName(cmSystemTools::GetFilenameName(newfile.c_str()).c_str(),
  55. path.c_str(),
  56. m_Makefile->GetSourceExtensions(),
  57. m_Makefile->GetHeaderExtensions());
  58. }
  59. else
  60. {
  61. file.SetName(newfile.c_str(), m_Makefile->GetCurrentDirectory(),
  62. m_Makefile->GetSourceExtensions(),
  63. m_Makefile->GetHeaderExtensions());
  64. }
  65. // add the source file to the makefile
  66. m_Makefile->AddSource(file);
  67. }
  68. }
  69. return true;
  70. }