We calculate the next-to-leading-order cross section for the inclusive
production of B mesons in pp collisions in the general-mass
variable-flavor-number scheme, an approach which takes into account the finite
mass of the b quarks. We use realistic evolved non-perturbative fragmentation
functions obtained from fits to e+e- data and compare results for the
transverse-momentum and rapidity distributions at a center-of-mass energy of 7
TeV with recent data from the CMS Collaboration. We find good agreement, in
particular at large values of pT.Comment: Minor changes to the text, accepted for publication in Phys. Rev.