Advertisement
Guest User

CPack File Name generators.

a guest
Mar 13th, 2012
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.94 KB | None | 0 0
  1. //----------------------------------------------------------------------
  2. std::string cmCPackGenerator::GetPackageFileName(
  3.         const std::string& packageFileNameTemplate)
  4. {
  5.   std::string sep = std::string(GetOption("CPACK_SEPARATOR"));
  6.  
  7.   std::vector<std::string> templateVector;
  8.   std::string tempPackageName;
  9.   cmSystemTools::ExpandListArgument(packageFileNameTemplate, templateVector, true);
  10.  
  11.   for(std::vector<std::string>::const_iterator it = templateVector.begin();
  12.           it != templateVector.end(); ++it)
  13.   {
  14.     if( *it == "CPACK_COMPONENT_NAME")
  15.       continue;
  16.  
  17.     if( !tempPackageName.empty() )
  18.       tempPackageName += sep;
  19.  
  20.     tempPackageName += std::string(GetOption((*it).c_str()));
  21.   }
  22.   return tempPackageName;
  23. }
  24.  
  25. //----------------------------------------------------------------------
  26. std::string cmCPackGenerator::GetPackageFileName(
  27.         const std::string& packageFileNameTemplate,
  28.         const std::string& groupOrComponentName)
  29. {
  30.   std::string sep = std::string(GetOption("CPACK_SEPARATOR"));
  31.   bool noName = false;
  32.   const char* noNameFor = GetOption("CPACK_COMPONENT_NONAME_FOR");
  33.   if ( !noNameFor && groupOrComponentName == "Unspecified" )
  34.   {
  35.     noName = true;
  36.   }
  37.   else if ( noNameFor && groupOrComponentName == noNameFor)
  38.   {
  39.     noName = true;
  40.   }
  41.  
  42.   if ( noName )
  43.       return GetPackageFileName(packageFileNameTemplate);
  44.  
  45.   std::vector<std::string> templateVector;
  46.   std::string tempPackageName;
  47.   cmSystemTools::ExpandListArgument(packageFileNameTemplate, templateVector, true);
  48.  
  49.   for(std::vector<std::string>::const_iterator it = templateVector.begin();
  50.           it != templateVector.end(); ++it)
  51.   {
  52.     if( !tempPackageName.empty() )
  53.       tempPackageName += sep;
  54.  
  55.     if ( *it == "CPACK_COMPONENT_NAME" )
  56.     {
  57.       tempPackageName += groupOrComponentName;
  58.     }else{
  59.       tempPackageName += std::string(GetOption((*it).c_str()));
  60.     }
  61.   }
  62.   return tempPackageName;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement