Fermionic condensate and the vacuum expectation values of the energy-momentum tensor are investigated for a massive spinor fields in higher-dimensional spacetimes with an arbitrary number of toroidally compactified spatial dimensions. By using the Abel-Plana summation formula and the zeta function technique we present the vacuum expectation values in two different forms. Applications of the general formulae to cylindrical and toroidal carbon nanotubes are given. We show that the topological Casimir energy is positive for metallic cylindrical nanotubes and is negative for semiconducting ones. The toroidal compactification of a cylindrical nanotube along its axis increases the Casimir energy for metallic-type (periodic) boundary conditions along its axis and decreases the Casimir energy for the semiconducting-type compactifications.