I don’t think the problem has anything to do with CMake, you seem to have inconsistent/incomplete installations of your system headers/libraries. I can’t tell you how to fix that, it’s a PC specific problem.
If you do a fresh/clean installation (e.g. in a container) CMake should compile without problems.
Why don’t you simply use the pre-built binaries from the homepage instead.