Results 1 to 5 of 5

Thread: MyLibrary - Install to /usr/lib

  1. #1
    Join Date
    May 2011
    Posts
    11
    Thanks
    2
    Qt products
    Qt4 Qt Jambi
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Wiki edits
    1

    Arrow MyLibrary - Install to /usr/lib

    Hello,

    I am writing an API at the moment and am doing so with some success. I can build it all fine, however i am wondering in my project file, is there a way to specify where the lib or application should be installed. So i don't have to specify the TARGET and build with super user permissions.

    I want people to be able to complile my library anywhere with the following
    Qt Code:
    1. qmake
    2. make
    3. sudo make install
    To copy to clipboard, switch view to plain text mode 

    So yea, not sure how to specify the install path. Just as an example project file. I may have something like the following

    Qt Code:
    1. TEMPLATE = lib
    2. TARGET = example
    3. DEPENDPATH += .
    4. INCLUDEPATH += .
    5. DESTDIR = build
    6.  
    7. VERSION = 1.0.0
    8.  
    9. MOC_DIR = mocs
    10. OBJECTS_DIR = obj
    11.  
    12. # Input
    13. HEADERS += example.h
    14. SOURCES += example.cpp
    To copy to clipboard, switch view to plain text mode 

    So the created .so is found in the build directory. So if i now execute make install i wish to install the .so into /usr/lib/ as libexample.so


    Any advice

    Cheers

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: MyLibrary - Install to /usr/lib

    Add the following to your project:
    qmake Code:
    1. unix {
    2. target.path = /usr/lib
    3. INSTALLS += target
    4. }
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    DaneAU (15th May 2011)

  4. #3
    Join Date
    May 2011
    Posts
    11
    Thanks
    2
    Qt products
    Qt4 Qt Jambi
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Wiki edits
    1

    Default Re: MyLibrary - Install to /usr/lib

    Wow lol, why didn't i ask earlier that was a pinch

    Thanks a bunch for responding so quickly mate

  5. #4
    Join Date
    Jan 2010
    Posts
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: MyLibrary - Install to /usr/lib

    I don't know if this is a better solution but I add this to my pro file.

    QMAKE_RPATHDIR=$$pathtomylibrary

    I used this because I didn't want to leave redundat libraries on people computer. So they could just delete the build folder and everything would be gone.
    If you want to know how to get the path to your library I used the variable $${OUT_PWD}.
    But because my project was a sub project it got a little confusing so I had the following code (Where publish is where all my compiled components go)

    DESTDIR = ../Publish/
    myfile=$${OUT_PWD}.txt
    buildfolder=$$dirname(myfile)
    buildfolder=$${buildfolder}/Publish
    QMAKE_RPATHDIR+=$$buildfolder

    Hope this gives you a good alternative. If you want to see the values of the variables you can out put them by adding

    message($$buildfolder)

    to your pro file.

    Also NOTE: that you place these in the pro file of the application that needs the library.

  6. The following user says thank you to dholliday for this useful post:

    DaneAU (25th September 2011)

  7. #5
    Join Date
    May 2011
    Posts
    11
    Thanks
    2
    Qt products
    Qt4 Qt Jambi
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Wiki edits
    1

    Default Re: MyLibrary - Install to /usr/lib

    Thanks for the information dholliday, i got my project file configured now and all is well

Similar Threads

  1. Replies: 6
    Last Post: 13th March 2011, 23:49
  2. Replies: 4
    Last Post: 18th April 2010, 00:37
  3. How to install Qt ???
    By dany_MB in forum Installation and Deployment
    Replies: 4
    Last Post: 2nd October 2008, 08:53
  4. How install fonts with make install
    By jiveaxe in forum Qt Programming
    Replies: 1
    Last Post: 2nd January 2008, 19:38
  5. "make install" doesn't install binary
    By jiveaxe in forum Newbie
    Replies: 2
    Last Post: 2nd January 2008, 12:00

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.