packaging: Initial packaging
[platform/upstream/cmake.git] / Source / cmFindLibraryCommand.h
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
4
5   Distributed under the OSI-approved BSD License (the "License");
6   see accompanying file Copyright.txt for details.
7
8   This software is distributed WITHOUT ANY WARRANTY; without even the
9   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10   See the License for more information.
11 ============================================================================*/
12 #ifndef cmFindLibraryCommand_h
13 #define cmFindLibraryCommand_h
14
15 #include "cmFindBase.h"
16
17
18 /** \class cmFindLibraryCommand
19  * \brief Define a command to search for a library.
20  *
21  * cmFindLibraryCommand is used to define a CMake variable
22  * that specifies a library. The command searches for a given
23  * file in a list of directories.
24  */
25 class cmFindLibraryCommand : public cmFindBase
26 {
27 public:
28   cmFindLibraryCommand();
29   /**
30    * This is a virtual constructor for the command.
31    */
32   virtual cmCommand* Clone()
33     {
34     return new cmFindLibraryCommand;
35     }
36
37   /**
38    * This is called when the command is first encountered in
39    * the CMakeLists.txt file.
40    */
41   virtual bool InitialPass(std::vector<std::string> const& args,
42                            cmExecutionStatus &status);
43
44   /**
45    * This determines if the command is invoked when in script mode.
46    */
47   virtual bool IsScriptable() const { return true; }
48
49   /**
50    * The name of the command as specified in CMakeList.txt.
51    */
52   virtual const char* GetName() const {return "find_library";}
53
54   /**
55    * Succinct documentation.
56    */
57   virtual const char* GetTerseDocumentation() const
58     {
59     return "Find a library.";
60     }
61   cmTypeMacro(cmFindLibraryCommand, cmFindBase);
62
63 protected:
64   void AddArchitecturePaths(const char* suffix);
65   void AddArchitecturePath(std::string const& dir,
66                            std::string::size_type start_pos,
67                            const char* suffix,
68                            bool fresh = true);
69   std::string FindLibrary();
70   virtual void GenerateDocumentation();
71 private:
72   std::string FindNormalLibrary();
73   std::string FindNormalLibraryNamesPerDir();
74   std::string FindNormalLibraryDirsPerName();
75   std::string FindFrameworkLibrary();
76   std::string FindFrameworkLibraryNamesPerDir();
77   std::string FindFrameworkLibraryDirsPerName();
78 };
79
80
81
82 #endif