cmSourceFilesRequireCommand.cxx 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2001 Insight Consortium
  8. All rights reserved.
  9. Redistribution and use in source and binary forms, with or without
  10. modification, are permitted provided that the following conditions are met:
  11. * Redistributions of source code must retain the above copyright notice,
  12. this list of conditions and the following disclaimer.
  13. * Redistributions in binary form must reproduce the above copyright notice,
  14. this list of conditions and the following disclaimer in the documentation
  15. and/or other materials provided with the distribution.
  16. * The name of the Insight Consortium, nor the names of any consortium members,
  17. nor of any contributors, may be used to endorse or promote products derived
  18. from this software without specific prior written permission.
  19. * Modified source versions must be plainly marked as such, and must not be
  20. misrepresented as being the original software.
  21. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
  22. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24. ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
  25. ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  27. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  28. CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  29. OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. =========================================================================*/
  32. #include "cmSourceFilesRequireCommand.h"
  33. // cmSourceFilesRequireCommand
  34. bool cmSourceFilesRequireCommand::Invoke(std::vector<std::string>& args)
  35. {
  36. this->SetError(" deprecated - use SourceFiles command inside an If block ");
  37. return false;
  38. std::vector<std::string>::iterator i = args.begin();
  39. // Search to the key word SOURCES_BEGIN is found
  40. // if one of the required defines is not there, then
  41. // return as none of the source files will be added
  42. // if the required definition is not there.
  43. while(i != args.end() && (*i) != "SOURCES_BEGIN" )
  44. {
  45. if(!m_Makefile->GetDefinition((*i).c_str()))
  46. {
  47. return true;
  48. }
  49. i++;
  50. }
  51. if(i != args.end())
  52. {
  53. i++;
  54. }
  55. // Add the rest of the arguments as source files
  56. const char *sname = (*i).c_str();
  57. ++i;
  58. for(; i != args.end(); ++i)
  59. {
  60. cmSourceFile file;
  61. file.SetIsAnAbstractClass(false);
  62. file.SetName((*i).c_str(), m_Makefile->GetCurrentDirectory());
  63. m_Makefile->AddSource(file, sname);
  64. }
  65. return true;
  66. }