Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QtCreator: kit-specific precompiler macro definitions
Forum Updated to NodeBB v4.3 + New Features

QtCreator: kit-specific precompiler macro definitions

Scheduled Pinned Locked Moved Qt Creator and other tools
4 Posts 2 Posters 3.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Morix Dev
    wrote on last edited by
    #1

    I am using QtCreator 3.1.1 to build a cross-platform project, and so I arranged to have different compilation kits for targeting my desktop PC and my BeagleBoneBlack (BBB).

    Now I would like to define some macro in qmake project file (.pro) which are specific only for a given kit.

    In other words I would like do in my .pro file something like:

    @ if(kit == BBB)
    DEFINES += MY_BBB_MACRO
    elseif(kit == Desktop)
    DEFINES += MY_DESKTOP_MACRO
    else
    DEFINES += OTHER_MACRO@

    Is is possible? How can I do that?

    /Morix

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      the qmake "built-in test functions":http://qt-project.org/doc/qt-5/qmake-test-function-reference.html#built-in-test-functions is what you can use.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Morix Dev
        wrote on last edited by
        #3

        Thanks koahnig... Following your hints I finally came up in adding a CONFIG directive to my platform, as in the following picture (in the provided example I added CONFIG+=BBB, on other kits I've added CONFIG+=AM335x and CONFIG+=Desktop):

        !http://it.tinypic.com/r/mh8qyg/8()!

        and then, using the built-in test functions, I slightly modified my .pro file to include the requested platform-specific defines:

        !http://it.tinypic.com/r/2qwcwhh/8()!

        and it works! Now in my code I can use #ifdef PLATFORM_BBB or #ifdef PLATFORM_AM335X or #ifdef PLATFORM_DESKTOP to differentiate the program behaviour on different platforms.

        Thanks!

        /Morix

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          You are welcome. Glad to see that my comment helped ;-)
          qmake is quite powerful, but the documentation and tutorials could benefit from a tune-up.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved