1
0

cmLinkLibrariesCommand.cxx 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 "cmLinkLibrariesCommand.h"
  14. // cmLinkLibrariesCommand
  15. bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string> const& args)
  16. {
  17. if(args.size() < 1 )
  18. {
  19. return true;
  20. }
  21. // add libraries, nothe that there is an optional prefix
  22. // of debug and optimized than can be used
  23. for(std::vector<std::string>::const_iterator i = args.begin();
  24. i != args.end(); ++i)
  25. {
  26. if ( *i == "NOTFOUND" )
  27. {
  28. this->SetError("CMake attempted to put directory that was not found to the list of include directories.");
  29. return false;
  30. }
  31. if (*i == "debug")
  32. {
  33. ++i;
  34. m_Makefile->AddLinkLibrary(i->c_str(),
  35. cmTarget::DEBUG);
  36. }
  37. else if (*i == "optimized")
  38. {
  39. ++i;
  40. m_Makefile->AddLinkLibrary(i->c_str(),
  41. cmTarget::OPTIMIZED);
  42. }
  43. else
  44. {
  45. m_Makefile->AddLinkLibrary(i->c_str());
  46. }
  47. const char* ldir = m_Makefile->GetDefinition("LIBRARY_OUTPUT_PATH");
  48. if (cmSystemTools::IsOff(ldir))
  49. {
  50. std::string libPath = *i + "_CMAKE_PATH";
  51. const char* dir = m_Makefile->GetDefinition(libPath.c_str());
  52. if( dir )
  53. {
  54. m_Makefile->AddLinkDirectory( dir );
  55. }
  56. }
  57. else
  58. {
  59. m_Makefile->AddLinkDirectory( ldir );
  60. }
  61. }
  62. return true;
  63. }