CMake를 사용하면서, 다른 컴파일러를 사용하고 싶을 때가 있다.
아래의 방법을 사용하면 간편하게 변경할 수 있다.
또한, cc
및 c++
명령어가 해당 컴파일러에 연결되게 만든다.
sudo update-alternatives --config c++
명령어를 입력하면,
There are 2 choices for the alternative c++ (providing /usr/bin/c++).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/bin/g++ 20 auto mode
* 1 /usr/bin/clang++ 10 manual mode
2 /usr/bin/g++ 20 manual mode
이 때, 숫자 키를 눌러서 컴파일러를 선택할 수 있다.
sudo update-alternatives --config c
마찬가지로 위의 방법과 같이 선택할 수 있다.