Friday, 22 May 2015

Setup clang compiler in Kdevelop


1. Install clang compiler with "sudo apt-get install clang-3.5"
2. In CMakeLists.txt of the project add at the very top of the file (before any other tags, like cmake_minimum_required() or project())
set(CMAKE_C_COMPILER "/usr/bin/clang-3.5")
set(CMAKE_CXX_COMPILER "/usr/bin/clang++-3.5")
3. In Kdevelop right-click on the project->Open Configuration->click on CMake tab->Click on a green plus button to configure new build directory. Put in a name for the new folder, like /home/d/projects/SomeProject/build_clang. Click "Apply" button. The Build console should print something like:
-- The C compiler identification is Clang 3.5.0
-- The CXX compiler identification is Clang 3.5.0
-- Check for working C compiler: /usr/bin/clang-3.5
-- Check for working C compiler: /usr/bin/clang-3.5 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/clang++-3.5
-- Check for working CXX compiler: /usr/bin/clang++-3.5 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
...

No comments :

Post a Comment