How to indicate gcc version for cmake?
我在ubuntu,
我尝试了如何为CMake指定新的GCC路径:
且特定:
1 2 | -DCMAKE_C_COMPILER=/usr/bin/gcc-5 -DCMAKE_CXX_COMPILER=/usr/bin/g++-5 |
,但给出错误:
1 2 3 4 5 6 7 8 | ubuntu@skc:~/jumanpp-2.0.0-rc2/bld$ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/Jumanpp -DCMAKE_C_COMPILER=/usr/bin/gcc-5 -DCMAKE_CXX_COMPILER=/usr/bin/g++-5 -- The C compiler identification is unknown -- The CXX compiler identification is unknown -- Check for working C compiler: /usr/bin/gcc-5 -- Check for working C compiler: /usr/bin/gcc-5 -- broken CMake Error at /usr/share/cmake-3.2/Modules/CMakeTestCCompiler.cmake:61 (message): The C compiler"/usr/bin/gcc-5" is not able to compile a simple test program. |
通过更改默认GCC解决了它:
1 | sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 |
(我需要更高的版本,因此从4.8更改为6)