  We derive a Wilson coefficient of a CP-violating purely gluonic dimension-6
operator called the Weinberg operator ($GG\tilde{G}$) generated by a scalar and
two fermions at the two-loop level. We do not specify the representation of
SU(3)$_c$ for the scalar and the fermions, and thus our result can be applied
to a variety of models beyond the standard model. We estimate the nucleon EDMs
induced by the Weinberg operator in some examples and discuss the importance of
measuring EDMs. It is found that future measurements of the EDMs can probe
physics at higher energy scale beyond the reach of collider experiments.
