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

Function FindInstallSource

Source/cmInstallProgramsCommand.cxx:111–134  ·  view source on GitHub ↗

* Find a file in the build or source tree for installation given a * relative path from the CMakeLists.txt file. This will favor files * present in the build tree. If a full path is given, it is just * returned. */

Source from the content-addressed store, hash-verified

109 * returned.
110 */
111static std::string FindInstallSource(cmMakefile& makefile, char const* name)
112{
113 if (cmSystemTools::FileIsFullPath(name) ||
114 cmGeneratorExpression::Find(name) == 0) {
115 // This is a full path.
116 return name;
117 }
118
119 // This is a relative path.
120 std::string tb = cmStrCat(makefile.GetCurrentBinaryDirectory(), '/', name);
121 std::string ts = cmStrCat(makefile.GetCurrentSourceDirectory(), '/', name);
122
123 if (cmSystemTools::FileExists(tb)) {
124 // The file exists in the binary tree. Use it.
125 return tb;
126 }
127 if (cmSystemTools::FileExists(ts)) {
128 // The file exists in the source tree. Use it.
129 return ts;
130 }
131 // The file doesn't exist. Assume it will be present in the
132 // binary tree when the install occurs.
133 return tb;
134}

Callers 1

FinalActionFunction · 0.70

Calls 2

cmStrCatFunction · 0.70
FileExistsFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…