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

Method FindCMakeResources

Source/cmSystemTools.cxx:3143–3195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3141}
3142
3143void cmSystemTools::FindCMakeResources(char const* argv0)
3144{
3145 std::string exe = FindOwnExecutable(argv0);
3146#ifdef CMAKE_BOOTSTRAP
3147 // The bootstrap cmake knows its resource locations.
3148 cmSystemToolsCMakeRoot = CMAKE_BOOTSTRAP_SOURCE_DIR;
3149 cmSystemToolsCMakeCommand = exe;
3150 // The bootstrap cmake does not provide the other tools,
3151 // so use the directory where they are about to be built.
3152 std::string exe_dir = CMAKE_BOOTSTRAP_BINARY_DIR "/bin";
3153#else
3154 // Find resources relative to our own executable.
3155 std::string exe_dir = cmSystemTools::GetFilenamePath(exe);
3156 bool found = false;
3157 // When running through a symlink to our own executable,
3158 // preserve symlinks in directory components if possible.
3159 do {
3160 found = FindCMakeResourcesInInstallTree(exe_dir);
3161 } while (!found && ResolveSymlinkToOwnExecutable(exe, exe_dir));
3162 // If we have not yet found the resources, the above loop will
3163 // have left 'exe' referring to a real file, not a symlink, so
3164 // all our binaries should exist under 'exe_dir'. However, the
3165 // resources may be discoverable only in the real path.
3166 if (!found) {
3167 found =
3168 FindCMakeResourcesInInstallTree(cmSystemTools::GetRealPath(exe_dir));
3169 }
3170 if (!found) {
3171 FindCMakeResourcesInBuildTree(exe_dir);
3172 }
3173 cmSystemToolsCMakeCommand =
3174 cmStrCat(exe_dir, "/cmake", cmSystemTools::GetExecutableExtension());
3175#endif
3176 cmSystemToolsCTestCommand =
3177 cmStrCat(exe_dir, "/ctest", cmSystemTools::GetExecutableExtension());
3178 cmSystemToolsCPackCommand =
3179 cmStrCat(exe_dir, "/cpack", cmSystemTools::GetExecutableExtension());
3180 cmSystemToolsCMakeGUICommand =
3181 cmStrCat(exe_dir, "/cmake-gui", cmSystemTools::GetExecutableExtension());
3182 if (!cmSystemTools::FileExists(cmSystemToolsCMakeGUICommand)) {
3183 cmSystemToolsCMakeGUICommand.clear();
3184 }
3185 cmSystemToolsCMakeCursesCommand =
3186 cmStrCat(exe_dir, "/ccmake", cmSystemTools::GetExecutableExtension());
3187 if (!cmSystemTools::FileExists(cmSystemToolsCMakeCursesCommand)) {
3188 cmSystemToolsCMakeCursesCommand.clear();
3189 }
3190 cmSystemToolsCMClDepsCommand =
3191 cmStrCat(exe_dir, "/cmcldeps", cmSystemTools::GetExecutableExtension());
3192 if (!cmSystemTools::FileExists(cmSystemToolsCMClDepsCommand)) {
3193 cmSystemToolsCMClDepsCommand.clear();
3194 }
3195}
3196
3197std::string const& cmSystemTools::GetCMakeCommand()
3198{

Callers

nothing calls this directly

Calls 8

FindOwnExecutableFunction · 0.85
GetRealPathFunction · 0.85
cmStrCatFunction · 0.70
FileExistsFunction · 0.50
clearMethod · 0.45

Tested by

no test coverage detected