The preconfiguration cycle (p-cycle) is an excellent protection scheme that benefits both the fast recovery time and the efficient resource utilization in wavelength-division-multiplexing (WDM) mesh networks. Before providing protection for any link whose end nodes are both on the p-cycle, the spare capacity assignment for the p-cycles is a very important step for p-cycle design in WDM networks. We present a heuristic scheme, called the p-Cycle Capacity Assignment Algorithm (CCAA), to achieve an optimal capacity assignment of p-cycles in WDM networks without using Integer Linear Programming (ILP). CCAA can configure the p-cycles with good actual efficiency because it first consumes the spare capacity of the links where more spare capacity exists. This scheme is more suitable for the design of maximum p-cycle restorability with a given spare capacity distribution. When allocating the spare capacity for the p-cycles in WDM mesh networks, this scheme considers the actual distribution of the working capacity and the spare capacity of a certain traffic pattern. The performance of CCAA is evaluated by computer simulations on the real-world network topology.