I would bet that enabling the toolset before launching CMake will do the trick. Otherwise set CC and/or CXX env var to the desired path before launching CMake.
Le jeu. 20 juin 2019 à 17:39, David Aldrich <david.aldrich.n...@gmail.com> a écrit : > My Centos 7.6 machine has CMake 3.13.5 and g++ 4.8.5 installed: > > $ /usr/bin/x86_64-redhat-linux-g++ --version > x86_64-redhat-linux-g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36) > > I have a very simple CMakeLists.txt: > > cmake_minimum_required(VERSION 3.5 FATAL_ERROR) > project(hello_world LANGUAGES CXX) > > add_executable(hello_world "") > > target_sources(hello_world > PRIVATE > main.cpp > Message.hpp > Message.cpp) > > I also have Redhat Developer Toolset 7 installed which I can enable in my > bash shell: > > $ scl enable devtoolset-7 bash > $ which g++ > /opt/rh/devtoolset-7/root/usr/bin/g++ > $ g++ --version > g++ (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5) > > How can I get CMake to use the later version of g++ instead of 4.8.5? > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > https://cmake.org/mailman/listinfo/cmake >
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake