cmFindLibraryCommand.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmFindLibraryCommand_h
  4. #define cmFindLibraryCommand_h
  5. #include "cmConfigure.h"
  6. #include <string>
  7. #include <vector>
  8. #include "cmFindBase.h"
  9. class cmCommand;
  10. class cmExecutionStatus;
  11. /** \class cmFindLibraryCommand
  12. * \brief Define a command to search for a library.
  13. *
  14. * cmFindLibraryCommand is used to define a CMake variable
  15. * that specifies a library. The command searches for a given
  16. * file in a list of directories.
  17. */
  18. class cmFindLibraryCommand : public cmFindBase
  19. {
  20. public:
  21. cmFindLibraryCommand();
  22. /**
  23. * This is a virtual constructor for the command.
  24. */
  25. cmCommand* Clone() CM_OVERRIDE { return new cmFindLibraryCommand; }
  26. /**
  27. * This is called when the command is first encountered in
  28. * the CMakeLists.txt file.
  29. */
  30. bool InitialPass(std::vector<std::string> const& args,
  31. cmExecutionStatus& status) CM_OVERRIDE;
  32. /**
  33. * The name of the command as specified in CMakeList.txt.
  34. */
  35. std::string GetName() const CM_OVERRIDE { return "find_library"; }
  36. protected:
  37. void AddArchitecturePaths(const char* suffix);
  38. void AddArchitecturePath(std::string const& dir,
  39. std::string::size_type start_pos,
  40. const char* suffix, bool fresh = true);
  41. std::string FindLibrary();
  42. private:
  43. std::string FindNormalLibrary();
  44. std::string FindNormalLibraryNamesPerDir();
  45. std::string FindNormalLibraryDirsPerName();
  46. std::string FindFrameworkLibrary();
  47. std::string FindFrameworkLibraryNamesPerDir();
  48. std::string FindFrameworkLibraryDirsPerName();
  49. };
  50. #endif