<div dir="ltr">My Centos 7.6 machine has CMake 3.13.5 and g++ 4.8.5 installed:<div><br></div><div>$ /usr/bin/x86_64-redhat-linux-g++ --version<br>x86_64-redhat-linux-g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)<br></div><div><br></div><div>I have a very simple CMakeLists.txt:</div><div><br></div><div>cmake_minimum_required(VERSION 3.5 FATAL_ERROR)<br>project(hello_world LANGUAGES CXX)<br><br>add_executable(hello_world "")<br><br>target_sources(hello_world<br>  PRIVATE<br>    main.cpp<br>    Message.hpp<br>    Message.cpp)<br></div><div><br></div><div>I also have Redhat Developer Toolset 7 installed which I can enable in my bash shell:</div><div><br></div>$ scl enable devtoolset-7 bash<br>$ which g++<br>/opt/rh/devtoolset-7/root/usr/bin/g++<br>$ g++ --version<br>g++ (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)<div><br></div><div>How can I get CMake to use the later version of g++ instead of 4.8.5?</div><div><br></div></div>