MCPcopy Create free account
hub / github.com/Kitware/CMake / NotInProjectDir

Class NotInProjectDir

Source/cmLocalUnixMakefileGenerator3.cxx:101–132  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

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.
101class NotInProjectDir
102{
103public:
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
127private:
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
135cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3(

Callers 2

UpdateDependenciesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…