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. Where to set conditional compile symbols in QtCreator?
Forum Updated to NodeBB v4.3 + New Features

Where to set conditional compile symbols in QtCreator?

Scheduled Pinned Locked Moved Qt Creator and other tools
5 Posts 3 Posters 4.5k 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.
  • S Offline
    S Offline
    svenyonson
    wrote on last edited by
    #1

    I am working on a QtWebKit project, where modules are enabled using the ENABLE(XXX) macros, which test for ENABLE_XXX to be defined. They are defined for the build in the .config file, but QtCreator does not know that the module has been linked in, and the code block is grayed out. Is there a way to have QtCreator read this .config file or some other way of setting the symbols so I can set breakpoints?

    I am building using a custom build step (build-webkit) and not using shadow builds.

    Setting the symbols in header files is not an option as it would break QtWebKit builds for everyone else.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #2

      Creator should parse the config file if it is included somewhere.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        svenyonson
        wrote on last edited by
        #3

        Where/how would I include the .config file?

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tobias.hunger
          wrote on last edited by
          #4

          I don't know your code, sorry.

          Usually you get a config.h file in C syntax with a lot of defines/undefines. This file is included all over the prokect. and Qt Creator should pick all the macros up. If it does not, then please "file a bug report":http://bugreports.qt-project.org/ .

          Other projects will just call the compiler with -DSOMETHING arguments or include/exclude files from building based on some configuration. Whether creator will do the right thing here depends mostly on the build system used (qmake should work IIRC, maybe autotools, cmake most likely not). There is unfortunately no way to manually add defines to a project.

          <REALLY DIRTY HACK>
          You can sneak macros into creator with a wrapper script around your compiler (provided it is GCC based): Creator runs "gcc -xc++ -E -dM ADDITIONAL_ARGS_FROM_BUILDSYSTEM -" to find all the predefined macros of a the compiler. If your wrapper amends more macros to that output then those will be honored by the code model. You can then set up your wrapper script as a new tool chain and use that to build.
          </REALLY DIRTY HACK>

          1 Reply Last reply
          0
          • F Offline
            F Offline
            Fran
            wrote on last edited by
            #5

            Any changes in this area?
            I am creating a project using CMake that sets several targets for the same codebase using the "target_compile_definitions" function of CMake in order to set different #defines for each target.

            When I try to add a .config file in Qt Creator, it seems unable to discover it. I even added the .config file to the CMake list of sources without luck.

            Any tips? (besides the <REALLY DIRTY HACK>, that is).

            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