Use ecm_generate_pkgconfig_file instead configure_file
The current solution with configure_file gave me a .pc file with incorrect values, e.g.:
$ pkg-config --cflags libKActivities -Iinclude -DQT_CORE_LIB -I/usr/x86_64-pc-linux-gnu/include/qt5/QtCore -I/usr/x86_64-pc-linux-gnu/include/qt5 $ pkg-config --libs libKActivities -Llib -lKF5Activities -lQt5Core
Using ecm_generate_pkgconfig_file fixes that and should also be nicer to maintain.