#184 Review PR

This PR is created for initial reviewing of the changes of #184 because #184 includes many external changes and hard to review.
I've never liked this change. I hope another way can be found and used before this leaves the branch. Need to investigate how CMake should handle this, or whether it relies on duplicating similar variable setting per platform?