QMake: Referencing a library using relative paths

sashoalm

I have a Qt project using SQLite, so I have the following directory structure:

C:\Workspace\MyProject\MyProject.pro
C:\Workspace\MyProject\sqlite3\sqlite3.lib

Adding sqlite3.lib with absolute paths works fine:

LIBS += -L"c:/Workspace/MyProject/sqlite3" -lsqlite3

But I can't make it work with relative paths. I try with:

LIBS += -L"sqlite3" -lsqlite3

But that fails with:

:-1: error: LNK1104: cannot open file 'sqlite3\sqlite3.lib'

I tried but LIBS += -L"../sqlite3" or even LIBS += -L"../../sqlite3", but that didn't work either.

I'm using MSVC 2008 for the compiler toolchain.

hluk

Since it's possible to build from different directory than project directory, relative path pointing to project directory should be prefixed with $$PWD/ (PWD qmake variable contains absolute path to directory with currently processed *.pro file).

Your line would look like:

LIBS += -L"$$PWD/sqlite3" -lsqlite3

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

QMake: Referencing a library using relative paths

From Dev

Patch Qmake to use specifics ( and relative) paths

From Dev

CMake cannot find a static library using relative file paths

From Dev

Reference shared libraries using relative paths or library names on OS X?

From Dev

Using require with relative paths

From Dev

Using Relative Paths in Crontab

From Dev

Using relative paths in recoll

From Dev

Using Relative Paths in Crontab

From Dev

Using relative paths for Windows shortcuts

From Dev

subprocess.Popen using relative paths

From Dev

Complete the relative paths to absolute using Python

From Dev

How to make intermediate object file not a library using qmake?

From Dev

How to build an standalone shared library in C++ using qmake?

From Dev

QMake generating weird paths in makefile

From Dev

Multiple install paths for qmake INSTALLS

From Dev

QMake generating weird paths in makefile

From Dev

Multiple Delphi versions using Jenkins: library paths

From Dev

Relative Referencing in Excel

From Dev

qmake checking for library

From Dev

Using relative paths in Rmarkdown when knitting from two different locations

From Dev

Create relative symlinks using absolute paths in Node.JS

From Dev

Issue with relative paths of resources files in an executable jar using Maven

From Dev

Selenium Webdriver: Page factory initialization using paths relative to other elements?

From Dev

Relative paths in CSS not valid when using MVC w/Bundles

From Dev

PHP - Using pathinfo variables makes relative paths not to work

From Dev

Resolving relative paths when using ph-schematron

From Dev

Issue with relative paths of resources files in an executable jar using Maven

From Dev

Using jQuery, relative paths within a div are updated to absolute paths but having trouble rewriting it to be more dynamic

From Dev

Relative paths on Xcode scripts

Related Related

  1. 1

    QMake: Referencing a library using relative paths

  2. 2

    Patch Qmake to use specifics ( and relative) paths

  3. 3

    CMake cannot find a static library using relative file paths

  4. 4

    Reference shared libraries using relative paths or library names on OS X?

  5. 5

    Using require with relative paths

  6. 6

    Using Relative Paths in Crontab

  7. 7

    Using relative paths in recoll

  8. 8

    Using Relative Paths in Crontab

  9. 9

    Using relative paths for Windows shortcuts

  10. 10

    subprocess.Popen using relative paths

  11. 11

    Complete the relative paths to absolute using Python

  12. 12

    How to make intermediate object file not a library using qmake?

  13. 13

    How to build an standalone shared library in C++ using qmake?

  14. 14

    QMake generating weird paths in makefile

  15. 15

    Multiple install paths for qmake INSTALLS

  16. 16

    QMake generating weird paths in makefile

  17. 17

    Multiple Delphi versions using Jenkins: library paths

  18. 18

    Relative Referencing in Excel

  19. 19

    qmake checking for library

  20. 20

    Using relative paths in Rmarkdown when knitting from two different locations

  21. 21

    Create relative symlinks using absolute paths in Node.JS

  22. 22

    Issue with relative paths of resources files in an executable jar using Maven

  23. 23

    Selenium Webdriver: Page factory initialization using paths relative to other elements?

  24. 24

    Relative paths in CSS not valid when using MVC w/Bundles

  25. 25

    PHP - Using pathinfo variables makes relative paths not to work

  26. 26

    Resolving relative paths when using ph-schematron

  27. 27

    Issue with relative paths of resources files in an executable jar using Maven

  28. 28

    Using jQuery, relative paths within a div are updated to absolute paths but having trouble rewriting it to be more dynamic

  29. 29

    Relative paths on Xcode scripts

HotTag

Archive