Moves functions out of the main CMakeLists file into module files that can just be included whenever necessary. This also uses the CMake provided variables for enforcing compiler requirements.