Qmake: using complex conglomerate option

  • Hi all,

    when compiling against llvm libs from command line (linux) using g++, I use:
    @g++ myfile.cpp llvm-config --cxxflags --ldflags --libs all --system-libs -std=c++11 -ldl -lpthread@

    Switching to QtCreator and qmake, I know I can add e.g.
    @QMAKE_CXXFLAGS += -std=c++11@
    to the .pro file

    But how could I add the llvm-config .... thing, which actually calls installed llvm-config to unfold to a large bunch of flags, includes and linked libs etc,?

    Ok, I could execute the command and then copy the result to all the different, appropriate qmake variables (INCLUDEPATH, QMAKE_CXXFLAGS ). This is laborious and needs reworking every time llvm-config options change.

    Any ideas?


  • No one?
    In the mean time I had gone the hard way and copied all instructions; Code compiles, runs and can be debugged.

  • Lifetime Qt Champion


    Please don't bump your own thread in such a short time. Allow 24 to 48 hours for people to see and respond to your thread. Not all members of this forum are in the same time zone as you.

    Back to your question, something like:

    QMAKE_CXXFLAGS += $$system('llvm-config --cxxflags')

    should do the trick. You can repeat it for the other flags in the appropriate variable.

    On a side note, c++11 can be activated through

    @CONFIG += c++11@

    Hope it helps

  • Oh,
    i didn't mean to bump. I just wanted to inform that going the long way works out. I should have done this as edit...

    Your suggestions work, thank you!

    As a side note: code completion for llvm 3.6 (using lots of std::unique_ptr stuff) works using the clang code model. The default c++ code model has a bug related (https://bugreports.qt.io/browse/QTCREATORBUG-8937).

    Now coding can start. Thanks to the Qt team for the great tools!

  • Lifetime Qt Champion

    You're welcome !

    Since you have your project running, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.