cmake: Fix build with thread support Move configure_file(config.h) below pthreads check. Fix regression caused by commit f5659a1.