Distribute Library



  • And another question, even if my other thread hasn't got any replies yet =S

    It's fairly easy to change the place where an executable or lib file being built should be placed. However, for a lib file to be useful I need also the corresponding C++ header files, which are located in my project directory.
    Is there a way to command QtCreator to copy all or only some marked header files into a differenct folder where also the lib file might reside?


  • Lifetime Qt Champion

    Hi,

    Are you thinking about using this lib in another sub-project in the same project ? Or when you're done building you are going to install it ?



  • No, it's not the same project.

    All I want to do is bundle the lib and header files together into one directory, possible divided into include and lib sub-directories.


  • Lifetime Qt Champion

    In that case you should take a look at the INSTALLS variable in qmake's variable reference documentation, it should provide you what you want.



  • Hm, INSTALLS seems they way to go, if I understood it correctly.
    I tried the following, but it doesn't work:

    @distHeaders.path = $$PWD/../../dist/include/
    distHeaders.files = $$HEADERS

    debug:target.path = $$PWD/../../dist/debug/
    release:target.path = $$PWD/../../dist/release/

    INSTALLS += distHeaders
    INSTALLS += target@



  • Ok, I tried some minimal example:

    @QT -= core gui

    TARGET = TestLib
    TEMPLATE = lib
    CONFIG += staticlib

    SOURCES += testlib.cpp

    HEADERS += testlib.h

    target.path = $$PWD/../dist
    INSTALLS += target

    test.path = $$PWD/../dist
    test.files = testLib.h
    INSTALLS += test@

    Wasn't succesful though.
    So I tought about using make manually, actually I'm not sure whether QtCreator supports installing at all.
    Make however complained about some missing seperators, the buggy lines look like this:

    @{..\TestLib}.cxx{debug}.obj::
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fodebug\ @<<
    $<
    <<@

    I changed it to this:

    @{..\TestLib}.cxx{debug}.obj::
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fodebug\ @<<
    $<
    <<@

    E: some whitespaces were magically removed.., just imagine the two inner lines with four spaces in front =D

    and make install actually worked, the files were copied.
    But now, buidling the library in QtCreator doesn't work anymore, it tells that testlib.obj cannot be open.
    Removing the "" or running qmake from QtCreator fixes this, but now the makefile is buggy again, so installing doesn't work.

    Whatsoever, did I something wrong or is this a bug?


  • Lifetime Qt Champion

    Did you call make install ?



  • Yes, from the console.

    As described in my post above, I had to "fix" the makefile to make it work.


  • Lifetime Qt Champion

    Sorry I misread your last post.

    Then there might be a bug in the Makefile generator. Did you check the "bug report system":http://bugreports.qt-project.org to see whether it's a know issue ?

    What OS are you on ? I'll try to reproduce it



  • My OS is Windows Vista, though I got Ubuntu on this laptop, too. Currently I'm not able to pass the project to Ubuntu, but when I'm at home, I'll try.

    Qt version is 5.1.1, QtCreator 2.8.1

    I found also this:
    https://bugreports.qt-project.org/browse/QTBUG-26455
    I'm not sure wheter it's somehow related or not.


  • Lifetime Qt Champion

    Might be, I'll try on OS X when I have some time later



  • Tested the make install command on Ubuntu with success, so it seems some windows thing.


Log in to reply
 

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