Figured it out. cmake was using an old version of gcc/g++, not the one that my command line was picking up when I ran gcc or g++ myself. So, I had to export CC and CXX to the appropriate paths before running cmake.

export CC=/opt/rh/devtoolset-7/root/usr/bin/gcc
export CXX=/opt/rh/devtoolset-7/root/usr/bin/g++
cmake3 -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ..

Previously, I was only running the last line above.

Answer from Josh1billion on Stack Exchange
🌐
GitHub
github.com › microsoft › vscode-cmake-tools › issues › 702
CMT not providing chosen compilerPath to cpptools · Issue #702 · microsoft/vscode-cmake-tools
June 25, 2019 - export CXX="/opt/rh/devtoolset-7/root/usr/bin/g++" export CC="/opt/rh/devtoolset-7/root/usr/bin/gcc" ... # Show compiler path message(STATUS "Compiler path: " ${CMAKE_CXX_COMPILER}) [cmake] Compiler path: /opt/rh/devtoolset-7/root/usr/bin/g++ [cmake] Configuring done
Author   microsoft
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 360004312319-enable-scl-devtoolset
enable scl devtoolset – IDEs Support (IntelliJ Platform) | JetBrains
If you work on a remote system like it seems you do, then it is the same, in your remote toolchain you should be able to point to devtoolset. Look on the top right of the "Toolchains" window and you will see a "System" or "Remote Host" drop-down list. ... For your information the only thing devtoolset is doing for you is providing a newer version for C/C++ Compiler and other tools like CMake, Make, etc.
🌐
CMake
cmake.org › pipermail › cmake › 2019-June › 069647.html
[CMake] How to specify Redhat Developer Toolset compiler?
June 20, 2019 - We have a similar issue at my company, so the call to /opt/rh/devtoolset-X/enable is done in our bashrc files Then we use CMAKE_<LANG>_COMPILER_VERSION in our cmake file to make sure its set correctly.
🌐
Bits and Dragons
bitsanddragons.wordpress.com › 2017 › 07 › 06 › install-simple-2-5-therefore-cmake-3-8-and-gcc-4-9-2-on-cent-os-7
Install Simple-2.5 (therefore cmake-3.8 and gcc-4.9.2) on Cent OS 7 | Bits and Dragons
March 7, 2018 - Now back to “simple”! I open ... compiled code. The fix is simple (JA JA): we remove the folder, unzip the program anew and place it again where the other was....
🌐
CMake Discourse
discourse.cmake.org › usage
Can CMake automatically detect RH devtoolset-7? - Usage - CMake Discourse
June 4, 2021 - I am building on Centos 7, which natively has gcc 4.8.5, using CMake 3.16.6 and Ninja. My code requires gcc 7 so I specify RH devtoolset-7: -DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/g++ My code checks the compiler version as follows: if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.4.0) message(FATAL_ERROR "g++ (GCC) version must be at least 5.4.0 (detected ${CMAKE_CXX_COMPILER_VERSION}). If on Centos 7, have you enabled Red...
🌐
Stack Overflow
stackoverflow.com › questions › 72894515 › visual-studio-code-intellisense-highlighting-using-scl-enable-devtoolset-8-and-c
Visual Studio Code Intellisense highlighting using scl enable devtoolset-8 and Cmake - Stack Overflow
Yes the highliting is enabled and works with the native compiler 4.8.5. It seems to be a problem with the devtoolset and cmake. When building the project VSCode/Cmake uses the old compiler version.
Find elsewhere
🌐
Mantidproject
developer.mantidproject.org › BuildingWithCMake.html
Building with CMake — MantidProject main documentation
Please note that the executable is called cmake3 on Red Hat 7 / CentOS7. On Red Hat 7 / CentOS7 mantid uses devtoolset-7. This means that you need to wrap your initial cmake command as scl enable devtoolset-7 "cmake3 /path/to/source".
🌐
Stack Overflow
stackoverflow.com › questions › tagged › devtoolset
Newest 'devtoolset' Questions - Stack Overflow
Bring the best of human thought ... at your work. Explore Stack Internal ... I'm facing a strange error ("reference to 'list' is ambiguous") in compiling a C++ 3rd party software under CentOS 7 with devtoolset-11. The situation can be summarized in this code snippet: ... ... When attempting to generate a large static library in a Fortran/C makefile-based project with devtoolset-11, the 'ar' step fails with: ar: first/object/in/alphabetical/order.o: file format not ... ... /usr/bin/cmake -E ...
🌐
The Mail Archive
mail-archive.com › cmake@cmake.org › msg60951.html
Re: [CMake] How to specify Redhat Developer Toolset compiler?
June 20, 2019 - You could set the environment variables CXX and CC such that they point to your toolset compiler Am 20.06.19 um 17:39 schrieb David Aldrich: > 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?
🌐
GitHub
github.com › ku-nlp › jumanpp › blob › master › docs › building.md
jumanpp/docs/building.md at master · ku-nlp/jumanpp
March 24, 2020 - # Install Software Collections and devtoolset (need to do only once) sudo yum install centos-release-scl sudo yum install devtoolset-7 llvm-toolset-7-cmake scl enable devtoolset-7 llvm-toolset-7 bash # Following lines should be typed from the build directory cmake .. -DCMAKE_BUILD_TYPE=Release make -j make test · Some IDEs provide builtin support for CMake projects and do not require manual installation of CMake.
Author   ku-nlp
🌐
GitHub
github.com › MaskRay › ccls › issues › 936
cmake build failed · Issue #936 · MaskRay/ccls
April 27, 2023 - 🍺 /root/go/src/github.com/ccls ☞ git:(master) clang --version clang version 5.0.1 (tags/RELEASE_501/final) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /opt/rh/llvm-toolset-7/root/usr/bin 🍺 /root/go/src/github.com/ccls ☞ git:(master) cmake --version cmake version 3.22.1 CMake suite maintained and supported by Kitware (kitware.com/cmake). ➜ /root/go/src/github.com/ccls ☞ git:(master) which gcc /opt/rh/devtoolset-7/root/usr/bin/gcc 🍺 /root/go/src/github.com/ccls ☞ git:(master)which cmake /usr/local/bin/cmake 🍺 /root/go/src/github.com/ccls ☞ git:(master)which g++ /opt/rh/devtoolset-7/root/usr/bin/g++
Author   MaskRay
🌐
GitHub
github.com › microsoft › vscode-cmake-tools › issues › 568
Is it possible to pass kit-specific environment variables to CMake? · Issue #568 · microsoft/vscode-cmake-tools
October 24, 2018 - { "name": "GCC 7.3.1", "compilers": { "CXX": "/opt/rh/devtoolset-7/root/usr/bin/g++", "C": "/opt/rh/devtoolset-7/root/usr/bin/gcc" }, "cmakeSettings": { "environment": { "LIB_COMPILER_PREFIX": "gcc_7" } } }, However it doesn't seem to be working. Is this behavior not supported, or am I doing it wrong?
Author   microsoft
🌐
Stack Overflow
stackoverflow.com › questions › tagged › devtoolset
Recently Active 'devtoolset' Questions - Stack Overflow
I run Centos 7, and I installed devtoolset-8 in order to get gcc 8. Here I found how to enable it for bash, which is done simply by adding source scl_source enable devtoolset-8 to .bashrc. If I ... ... I am trying to enable vtable verification in my project. When I try to use the flag (-fvtable-verify=std) I get an error g++: error: -fvtable-verify=std is not supported in this configuration. Can ... ... /usr/bin/cmake -E cmake_link_script CMakeFiles/YikeSim.dir/link.txt --verbose=1 /data/mpich/bin/mpic++ -Wl,--rpath=./shared_lib/linux -std=c++17 -g -O3 -mavx -fopenmp -Wall -D CMAKE_COMPILE -L /usr/...
🌐
GitHub
github.com › MISP › MISP › issues › 2743
Install steps for LIEF on Red Hat Enterprise Linux 7.4 · Issue #2743 · MISP/MISP
December 17, 2017 - cd $LIEF_TMP/LIEF mkdir -p build cd build scl enable devtoolset-7 'bash -c "cmake3 \ -DLIEF_PYTHON_API=on \ -DLIEF_DOC=off \ -DCMAKE_INSTALL_PREFIX=$LIEF_INSTALL \ -DCMAKE_BUILD_TYPE=Release \ -DPYTHON_VERSION=2.7 \ .."' make -j3 cd api/python python setup.py install || : cd $LIEF_TMP/LIEF/build make install make package
Author   MISP
🌐
GitHub
github.com › microsoft › vscode-cpptools › issues › 3819
cpptools seems not to be receiving compiler path from CMake Tools · Issue #3819 · microsoft/vscode-cpptools
June 24, 2019 - [cmake] Compiler path: /opt/rh/devtoolset-7/root/usr/bin/g++ but my source code has: #if __GNUC__ && (__cplusplus < 201402L) #error Requires a C++14 compliant compiler (gcc 5 or greater) #endif · and I get a red squiggle: The workspaces settings.json contains: { "C_Cpp.default.configurationProvider": "vector-of-bool.cmake-tools", "cmake.buildDirectory": "${workspaceRoot}/${buildType}" } Should vscode-cmake-tools provide the compiler path to the cpptools or do I need to specify it separately in cpptools settings?
Author   microsoft
🌐
CMake
cmake.org › pipermail › cmake › 2014-March › 057188.html
[CMake] wrapper around real compiler
March 12, 2014 - Details: https://access.redhat... enable devtoolset-2 ' gcc <DEFINES> <FLAGS> -frandom-seed=<SOURCE>/ -o <OBJECT> -c <SOURCE>' ") The only working one that I found is to use small bash script which will act as yet another wrapper. Anyway this solution do not looks "elegant" ...