cmake: Build Linux-specific files like the configure script does. Otherwise we unconditionally compile things we shouldn't. Fixes Bugzilla #5175.