Important: Please read the Qt Code of Conduct -

How to configure kit (toolchain) for clang with cmake project?

  • I have recently added clang 3.1 to my Ubuntu installation.
    However I am having trouble with making it compile via kits.
    in Build & Run -> compilers
    both gcc and clang are detected (in both 64 and 32 bit versions)

    However, when I create kit based on clang and I run cmake again
    Projects -> Build Settings -> Reconfigure project: Run cmake

    it fails to switch to clang - e.g. compilation is always done via default gcc

    p.s. when I manually test cmake in fresh build directory, clang works e.g.:
    cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ../source

    Does kits / compiler selection work only with qmake?

  • Moderators

    Switching kits does indeed not work fully with cmake: There are standard flags that cmake usually uses to set the compiler. A CMakeLists.txt file is free to do something else though. If that happens, then you will need to manually configure that.

    Sorry, cmake is just not made to integrate with an IDE:(

  • I just checked and it seems that setting kits for cmake is still not supported in qtcreator 2.8. Could you please consider providing those compiler specific settings for cmake? It would make swtiching kits in qtcreator really easy for most cases. If the user will override those variables in his CMakefileList.txt file it is his fault :-P

Log in to reply