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. Not sure about how to use the INSTALLS functionality of the project file
Forum Updated to NodeBB v4.3 + New Features

Not sure about how to use the INSTALLS functionality of the project file

Scheduled Pinned Locked Moved Qt Creator and other tools
15 Posts 2 Posters 5.3k 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.
  • A Offline
    A Offline
    alexandros
    wrote on last edited by
    #5

    Are you sure about this?
    docfiles.path = $(PWD)/usr/share/doc/

    -$(INSTALL_DIR) $(PWD)/data/doc/wallch $(INSTALL_ROOT)/usr/share/doc/

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #6

      Actually you'll need to add a preceding slash to make it an absolute path, otherwise qmake will append the working directory and as long as you guarantee that INSTALL_ROOT is empty it will expand to the correct path.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        alexandros
        wrote on last edited by
        #7

        So has it to be
        docfiles.path = /$(PWD)/usr/share/doc/ ?

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on last edited by
          #8

          Yes. Is there a reason you do not want to distribute the .pro file along with your application?

          1 Reply Last reply
          0
          • A Offline
            A Offline
            alexandros
            wrote on last edited by
            #9

            What make you believe I DO NOT want to do so?

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lgeyer
              wrote on last edited by
              #10

              Because all this stuff isn't needed if you use "qmake's variables":http://doc.qt.nokia.com/latest/qmake-variable-reference.html directly and the user just runs qmake to generate proper makefiles.

              I probably misunderstood your inital question which led to the slightly confusing response.

              There are two types of variables you can use with qmake

              • qmake variables, which are processed when qmake is run, like $$PWD
              • environment variables, which are processed when make is run, like $(PWD)

              As qmake creates makefiles with absolute pathes (relative ones are automatically expanded by $PWD) you will have to either re-run qmake if your pathes change or you will have to rely on environment variables (which can be a bit tricky as you can see).

              So the most simple answer to your question is: Yes. Everybody will have to run qmake.
              At least there is no option to qmake I know of which prohibits the generation of absolute pathes.

              When talking about INSTALLS one should further mention that if you want to install files which are generated during build (for example generated help files or such) you will have to prepend your relative pathes with $$OUT_PWD to support out of source builds.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                alexandros
                wrote on last edited by
                #11

                Ok, thanks for this.
                Something else, because it is similar and I don't want to start another thread...
                In my project file I have:
                @DEFINES +="PREFIX="/usr/local""@
                How do I use this definition in my program?
                For example:
                @ cout << PREFIX;@
                gives error:
                @ /usr/local was not declared in this scope@
                and when I use:
                @ cout << "PREFIX";@
                of course it outputs
                @ PREFIX@

                I don't know what to do :/

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  lgeyer
                  wrote on last edited by
                  #12

                  Just add an escaped backslash to DEFINES so the quotation marks correctly pass through
                  @
                  DEFINES += "PREFIX=\"/usr/local\""
                  ...
                  std::cout << PREFIX;
                  @
                  or quote the preprocessor macro in your code correctly.
                  @
                  DEFINES +="PREFIX="/usr/local""
                  ...
                  #define QUOTE(string) _QUOTE(string)
                  #define _QUOTE(string) #string
                  ...
                  std::cout << QUOTE(PREFIX);
                  @

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    alexandros
                    wrote on last edited by
                    #13

                    Thanks Lukas, the former worked OK!
                    Something else, can I use the definition PREFIX on my INSTALLS rules inside the project file?
                    For example, can I say
                    @configfiles.path = $$PREFIX@ (meaning configfiles.path = /usr/local)
                    and if yes, how?

                    1 Reply Last reply
                    0
                    • L Offline
                      L Offline
                      lgeyer
                      wrote on last edited by
                      #14

                      For sure.
                      @
                      PREFIX = /usr/local
                      DEFINES += "PREFIX=\"$$PREFIX\""
                      configfiles.path = $$PREFIX
                      @

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        alexandros
                        wrote on last edited by
                        #15

                        Good ;)

                        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