cmFindLibraryCommand.h 1.6 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" // IWYU pragma: keep
  6. #include <string>
  7. #include <vector>
  8. #include "cm_memory.hxx"
  9. #include "cmCommand.h"
  10. #include "cmFindBase.h"
  11. class cmExecutionStatus;
  12. /** \class cmFindLibraryCommand
  13. * \brief Define a command to search for a library.
  14. *
  15. * cmFindLibraryCommand is used to define a CMake variable
  16. * that specifies a library. The command searches for a given
  17. * file in a list of directories.
  18. */
  19. class cmFindLibraryCommand : public cmFindBase
  20. {
  21. public:
  22. cmFindLibraryCommand();
  23. /**
  24. * This is a virtual constructor for the command.
  25. */
  26. std::unique_ptr<cmCommand> Clone() override
  27. {
  28. return cm::make_unique<cmFindLibraryCommand>();
  29. }
  30. /**
  31. * This is called when the command is first encountered in
  32. * the CMakeLists.txt file.
  33. */
  34. bool InitialPass(std::vector<std::string> const& args,
  35. cmExecutionStatus& status) override;
  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