Algorithms for spectrum sharing over resource‐limited cognitive radio networks are often designed to solve specific problems. This means that a certain algorithm deals specifically with a certain limited resource, and is not suitable for other resources. This limitation violates the software‐defined networking philosophy, where a scheme has to be reprogrammable to cope with different limited resources that can dynamically arise depending on network conditions. In this work, we investigate the problem of spectrum sharing in resource‐limited cognitive radio networks. Specifically, we introduce a novel spectrum sharing algorithm that is compatible with software‐defined networks, in the sense that it can be reprogrammed to support multiple constraints on resources of different types. A main feature of the proposed scheme is that computations could be distributed across multiple processing units to reduce computational complexity on each unit. In addition, the proposed algorithm is equipped with a fairness scheme. Simulation results demonstrate the efficacy of the proposed scheme.