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

Method InstallProjectViaInstalledDirectories

Source/CPack/cmCPackGenerator.cxx:364–499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

362}
363
364int cmCPackGenerator::InstallProjectViaInstalledDirectories(
365 bool setDestDir, std::string const& tempInstallDirectory,
366 mode_t const* default_dir_mode)
367{
368 (void)setDestDir;
369 (void)tempInstallDirectory;
370 std::vector<cmsys::RegularExpression> ignoreFilesRegex;
371 cmValue cpackIgnoreFiles = this->GetOption("CPACK_IGNORE_FILES");
372 if (cpackIgnoreFiles) {
373 cmList ignoreFilesRegexString{ cpackIgnoreFiles };
374 for (std::string const& ifr : ignoreFilesRegexString) {
375 cmCPackLogger(cmCPackLog::LOG_VERBOSE,
376 "Create ignore files regex for: " << ifr << std::endl);
377 ignoreFilesRegex.emplace_back(ifr);
378 }
379 }
380 cmValue installDirectories = this->GetOption("CPACK_INSTALLED_DIRECTORIES");
381 if (cmNonempty(installDirectories)) {
382 cmList installDirectoriesList{ installDirectories };
383 if (installDirectoriesList.size() % 2 != 0) {
384 cmCPackLogger(
385 cmCPackLog::LOG_ERROR,
386 "CPACK_INSTALLED_DIRECTORIES should contain pairs of <directory> "
387 "and "
388 "<subdirectory>. The <subdirectory> can be '.' to be installed in "
389 "the toplevel directory of installation."
390 << std::endl);
391 return 0;
392 }
393 cmList::iterator it;
394 std::string const& tempDir = tempInstallDirectory;
395 for (it = installDirectoriesList.begin();
396 it != installDirectoriesList.end(); ++it) {
397 std::vector<std::pair<std::string, std::string>> symlinkedFiles;
398 cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl);
399 cmsys::Glob gl;
400 std::string top = *it;
401 ++it;
402 std::string subdir = *it;
403 std::string findExpr = cmStrCat(top, "/*");
404 cmCPackLogger(cmCPackLog::LOG_OUTPUT,
405 "- Install directory: " << top << std::endl);
406 gl.RecurseOn();
407 gl.SetRecurseListDirs(true);
408 gl.SetRecurseThroughSymlinks(false);
409 if (!gl.FindFiles(findExpr)) {
410 cmCPackLogger(cmCPackLog::LOG_ERROR,
411 "Cannot find any files in the installed directory"
412 << std::endl);
413 return 0;
414 }
415 this->files = gl.GetFiles();
416 for (std::string const& gf : this->files) {
417 bool skip = false;
418 std::string inFile = gf;
419 if (cmSystemTools::FileIsDirectory(gf) &&
420 !cmSystemTools::FileIsSymlink(gf)) {
421 inFile += '/';

Callers 1

InstallProjectMethod · 0.95

Calls 14

GetOptionMethod · 0.95
cmNonemptyFunction · 0.85
moveFunction · 0.85
emplace_backMethod · 0.80
FindFilesMethod · 0.80
FailedMethod · 0.80
cmStrCatFunction · 0.50
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
GetFilesMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected