Clarify documentation for if.
[cmake.git] / Source / cmOrderDirectories.h
blobb88383900d9da9087c08bfe8f7dfe363e432720d
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmOrderDirectories.h,v $
5 Language: C++
6 Date: $Date: 2009-07-27 16:43:17 $
7 Version: $Revision: 1.5 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #ifndef cmOrderDirectories_h
18 #define cmOrderDirectories_h
20 #include "cmStandardIncludes.h"
22 #include <cmsys/RegularExpression.hxx>
24 class cmGlobalGenerator;
25 class cmOrderDirectoriesConstraint;
26 class cmOrderDirectoriesConstraintLibrary;
27 class cmTarget;
29 /** \class cmOrderDirectories
30 * \brief Compute a safe runtime path order for a set of shared libraries.
32 class cmOrderDirectories
34 public:
35 cmOrderDirectories(cmGlobalGenerator* gg, cmTarget* target,
36 const char* purpose);
37 ~cmOrderDirectories();
38 void AddRuntimeLibrary(std::string const& fullPath, const char* soname = 0);
39 void AddLinkLibrary(std::string const& fullPath);
40 void AddUserDirectories(std::vector<std::string> const& extra);
41 void AddLanguageDirectories(std::vector<std::string> const& dirs);
42 void SetImplicitDirectories(std::set<cmStdString> const& implicitDirs);
43 void SetLinkExtensionInfo(std::vector<std::string> const& linkExtensions,
44 std::string const& removeExtRegex);
46 std::vector<std::string> const& GetOrderedDirectories();
47 private:
48 cmGlobalGenerator* GlobalGenerator;
49 cmTarget* Target;
50 std::string Purpose;
52 bool Computed;
54 std::vector<std::string> OrderedDirectories;
56 bool OrderedDirectoriesComputed;
57 std::vector<cmOrderDirectoriesConstraint*> ConstraintEntries;
58 std::vector<cmOrderDirectoriesConstraint*> ImplicitDirEntries;
59 std::vector<std::string> UserDirectories;
60 std::vector<std::string> LanguageDirectories;
61 cmsys::RegularExpression RemoveLibraryExtension;
62 std::vector<std::string> LinkExtensions;
63 std::set<cmStdString> ImplicitDirectories;
64 std::set<cmStdString> EmmittedConstraintSOName;
65 std::set<cmStdString> EmmittedConstraintLibrary;
66 std::vector<std::string> OriginalDirectories;
67 std::map<cmStdString, int> DirectoryIndex;
68 std::vector<int> DirectoryVisited;
69 void CollectOriginalDirectories();
70 int AddOriginalDirectory(std::string const& dir);
71 void AddOriginalDirectories(std::vector<std::string> const& dirs);
72 void FindConflicts();
73 void FindImplicitConflicts();
74 void OrderDirectories();
75 void VisitDirectory(unsigned int i);
76 void DiagnoseCycle();
77 bool CycleDiagnosed;
78 int WalkId;
80 // Adjacency-list representation of runtime path ordering graph.
81 // This maps from directory to those that must come *before* it.
82 // Each entry that must come before is a pair. The first element is
83 // the index of the directory that must come first. The second
84 // element is the index of the runtime library that added the
85 // constraint.
86 typedef std::pair<int, int> ConflictPair;
87 struct ConflictList: public std::vector<ConflictPair> {};
88 std::vector<ConflictList> ConflictGraph;
90 friend class cmOrderDirectoriesConstraint;
91 friend class cmOrderDirectoriesConstraintLibrary;
94 #endif