How to add post install script to source rpm?

Dear CMakers/CPackers, there is an internal legacy software at work that I am distributing via RPM-s. My problem is that both the binary and source RPMs need to do some configurations at install time.
The binary one is easy with setting CPACK_RPM_POST_INSTALL_SCRIPT_FILE, but could not find a way to do the same for the source. Can somebody please give me some ideas?