CP violation conditions in N-Higgs-doublet potentials