CMake: Make the code more platform-agnostic and cleaner.