* 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. */
| 135 | * returned. |
| 136 | */ |
| 137 | static std::string FindInstallSource(cmMakefile& makefile, char const* name) |
| 138 | { |
| 139 | if (cmSystemTools::FileIsFullPath(name) || |
| 140 | cmGeneratorExpression::Find(name) == 0) { |
| 141 | // This is a full path. |
| 142 | return name; |
| 143 | } |
| 144 | |
| 145 | // This is a relative path. |
| 146 | std::string tb = cmStrCat(makefile.GetCurrentBinaryDirectory(), '/', name); |
| 147 | std::string ts = cmStrCat(makefile.GetCurrentSourceDirectory(), '/', name); |
| 148 | |
| 149 | if (cmSystemTools::FileExists(tb)) { |
| 150 | // The file exists in the binary tree. Use it. |
| 151 | return tb; |
| 152 | } |
| 153 | if (cmSystemTools::FileExists(ts)) { |
| 154 | // The file exists in the source tree. Use it. |
| 155 | return ts; |
| 156 | } |
| 157 | // The file doesn't exist. Assume it will be present in the |
| 158 | // binary tree when the install occurs. |
| 159 | return tb; |
| 160 | } |
no test coverage detected
searching dependent graphs…