Variables in generic project



  • Hi,

    I know how to define and use variables in qmake projects (.pro).
    I can't seem to find a way to do it in a generic project (made of .config, .creator, .files, .includes).
    Typically I'd like to use an environment or Qt variable for a part of the path when listing project files in .files and include paths in .includes.

    Something like for .includes:
    ${MY_ENV_VAR}/MyProject

    Any help would be appreciated. Thanks.

    René



  • hello,

    i'm not sure, if that is possible for the specific group of files.
    re-reading the "doc":http://qt-project.org/doc/qtcreator-2.6/creator-project-generic.html doesn't provide any clue to that direction.

    however, it gives an example of automating the creation of the .files using git.

    you could generate the literal values for the contents of those files using a generic bash script and a per project script that would just expose those values to the generic script's environment

    e.g.

    for project "foo"

    @
    #!/bin/bash

    export PRJ_NAME=foo
    export PRJ_HDR_DIR=foo/include
    export DB_HDR_DIR=foo/db/include

    etc

    @

    for project "bar"

    @
    #!/bin/bash

    export PRJ_NAME=bar
    export PRJ_HDR_DIR=bar/include
    export DB_HDR_DIR=bar/db/include

    etc

    @

    then you could have your generic script do smt like

    @
    #!/bin/bash

    echo ${PRJ_HDR_DIR} >> ${PRJ_NAME}.includes
    echo ${DB_HDR_DIR} >> ${PRJ_NAME}.includes
    @

    it's kinda hard to suggest a specific solution tailored to your needs.
    hope this helps



  • Hello Compor,

    Thanks for your suggestions.

    Writing a script is what I ended up to.
    The scripts generates .files and .includes (based on .files + default ones).
    The other ones are copies of "templates" (.creator, .config, .creator.user).

    It's true that generic projects are not well documented. For example what's the syntax of .config and .creator? Could I define variables in there?

    For the records I use QtCreator for editing APEX/Summit code, which enforces a hierarchy of the type <MySubSystem>/<MySubSystem>.<MyView> (a sub system being a project). Yeah, I know it's weird.

    Cheers

    René


Log in to reply
 

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