[3107] Move CXX_VERSION initialization closer to where it is used