cmFindLibraryCommand.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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" // IWYU pragma: keep
  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() 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) override;
  32. protected:
  33. void AddArchitecturePaths(const char* suffix);
  34. void AddArchitecturePath(std::string const& dir,
  35. std::string::size_type start_pos,
  36. const char* suffix, bool fresh = true);
  37. std::string FindLibrary();
  38. private:
  39. std::string FindNormalLibrary();
  40. std::string FindNormalLibraryNamesPerDir();
  41. std::string FindNormalLibraryDirsPerName();
  42. std::string FindFrameworkLibrary();
  43. std::string FindFrameworkLibraryNamesPerDir();
  44. std::string FindFrameworkLibraryDirsPerName();
  45. };
  46. #endif