Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Stupid question: how to add reference in .pro file to static lib compiled from source
Forum Updated to NodeBB v4.3 + New Features

Stupid question: how to add reference in .pro file to static lib compiled from source

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 3.4k 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.
  • D Offline
    D Offline
    deion
    wrote on last edited by
    #1

    Hi,

    As you can guess from the title of this post I'm a newbie to Qt.
    I have a simple problem which I do not know how to solve:
    I want to use the qjson library. I downloaded the source code in PRJOECTS/qjson (where PROJECTS is the root directory
    of my working projects, let's say "c:\work\cuteprojs" or something like it, I put all my qt projects in there)
    I have successfully compiled qjson for harmattan and desktop; After the build I have 2 directories:
    PROJECTS/qjson-build-desktop & PROJECTS/qjson-build-harmattan

    Now I have another project, TestQJson, where I want to use the static lib generated from the qjson projects.
    Inside PROJECTS/TestQJson/TestQJson.pro file I add the following:

    1. INCLUDEPATH += ../qjson/src
    2. LIBS += -lqjson
    3. LIBS += -L../qjson-build-harmattan/lib/

    For line 1) everything is clear, TestQJSon correctly finds the necessary .h files from qjson.
    Now in line 2) I tell QMAKE (or whatever trolls refer to the build system/framework/makefile/etc) that TestQJson will link to the static qjson library; and in line 3) I tell it where to find this library. It compiles and everything is ok.

    HOWEVER, if now I want to build for desktop target I need to modify line 3) like this:
    3) LIBS += -L../qjson-build-desktop/lib/

    Is there a more elegant solution to this problem?
    (Please ignore the qjson reference, e.g. the issue is not related to the qjson project, it's related to any other project that builds as a static lib)

    Thanks & regards,
    Ionut

    1 Reply Last reply
    0
    • L Offline
      L Offline
      ludde
      wrote on last edited by
      #2

      Have at look at "scopes":http://doc.qt.nokia.com/latest/qmake-advanced-usage.html#scopes in the qmake manual.

      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