Helper predicate for removing absolute paths that don't point to the source or binary directory. It is used when CMAKE_DEPENDS_IN_PROJECT_ONLY is set ON, to only consider in-project dependencies during the build.
| 99 | // source or binary directory. It is used when CMAKE_DEPENDS_IN_PROJECT_ONLY |
| 100 | // is set ON, to only consider in-project dependencies during the build. |
| 101 | class NotInProjectDir |
| 102 | { |
| 103 | public: |
| 104 | // Constructor with the source and binary directory's path |
| 105 | NotInProjectDir(cm::string_view sourceDir, cm::string_view binaryDir) |
| 106 | : SourceDir(sourceDir) |
| 107 | , BinaryDir(binaryDir) |
| 108 | { |
| 109 | } |
| 110 | |
| 111 | // Operator evaluating the predicate |
| 112 | bool operator()(std::string const& p) const |
| 113 | { |
| 114 | auto path = cmCMakePath(p).Normal(); |
| 115 | |
| 116 | // Keep all relative paths: |
| 117 | if (path.IsRelative()) { |
| 118 | return false; |
| 119 | } |
| 120 | |
| 121 | // If it's an absolute path, check if it starts with the source |
| 122 | // directory: |
| 123 | return !(cmCMakePath(this->SourceDir).IsPrefix(path) || |
| 124 | cmCMakePath(this->BinaryDir).IsPrefix(path)); |
| 125 | } |
| 126 | |
| 127 | private: |
| 128 | // The path to the source directory |
| 129 | cm::string_view SourceDir; |
| 130 | // The path to the binary directory |
| 131 | cm::string_view BinaryDir; |
| 132 | }; |
| 133 | } |
| 134 | |
| 135 | cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3( |
no outgoing calls
no test coverage detected
searching dependent graphs…