cmTryCompileCommand.cxx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 "cmTryCompileCommand.h"
  14. #include "cmCacheManager.h"
  15. // cmExecutableCommand
  16. bool cmTryCompileCommand::InitialPass(std::vector<std::string> const& argv)
  17. {
  18. if(argv.size() < 4)
  19. {
  20. return false;
  21. }
  22. const char* sourceDirectory = argv[1].c_str();
  23. const char* binaryDirectory = argv[2].c_str();
  24. const char* projectName = argv[3].c_str();
  25. const char* targetName = 0;
  26. if (argv.size() == 5)
  27. {
  28. targetName = argv[4].c_str();
  29. }
  30. int res = m_Makefile->TryCompile(sourceDirectory, binaryDirectory,
  31. projectName, targetName);
  32. // set the result var to the return value to indicate success or failure
  33. m_Makefile->AddDefinition(argv[0].c_str(), (res == 0 ? "TRUE" : "FALSE"));
  34. return true;
  35. }