Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[Solved] Qt, .pro file and platform



  • I have to include a lib only in I compile the program on Arm. How can I do?
    Something like this:

    unix:__arm__ {
        LIBS += ../../raspicam-0.1.1/build/src/libraspicam.so
    }
    

    but does not work.



  • R u using qt creator ??

    If u r using qt creator, then add library by right click on project and select the Add Library.. . I think it is some how easy way.



  • Hi mrdebug,

    we are doing similar things here, too. And they do work. So there might be two issues with your .pro file:

    1. Are you sure "unix:arm" ist the correct expression for that platform? To check you can add a message statement like this:

    @unix:arm {
    message(unix_arm reached)
    LIBS += ../../raspicam-0.1.1/build/src/libraspicam.so
    }@

    Then run qmake and take a look at the ouput.

    1. When using a Unix environment, you should add a "-L" before the library name and omit the "lib" and ".so" part of the library name. Looks like qmake translates the "LIBS" variable very directly into gcc command lines.
      So maybe this works for you:

    @unix:arm {
    message(unix_arm reached)
    LIBS += -L../../raspicam-0.1.1/build/src/raspicam
    }@

    /thomas



  • I want the same .pro file for both i386 and arm. But only on arm I have to include the libraspicam.
    I have tried

    @unix {

    unix:arm {
        LIBS += ../../raspicam-0.1.1/build/src/libraspicam.so
    }
    

    }
    @

    but does not work. If I compile the app in i386 (Linux) the compiler wants the libraspicam.


  • Lifetime Qt Champion

    Hi,

    From the top of my head it should be something like:

    @linux-arm-gnueabi-g++:message(using arm)@



  • Solved with
    @unix {

    message(using arm) {
        LIBS += ../../raspicam-0.1.1/build/src/libraspicam.so
    }
    

    }@


  • Lifetime Qt Champion

    That might work if you are on windows otherwise it won't



  • According to
    http://qt-project.org/doc/qt-4.8/qmake-function-reference.html#contains-variablename-value

    @ exists(../../raspicam-0.1.1/build/src/libraspicam.so) {
    message(../../raspicam-0.1.1/build/src/libraspicam.so exists)
    LIBS += ../../raspicam-0.1.1/build/src/libraspicam.so
    } else {
    message(Not exists)
    }

    message(Platform: $$QMAKE_HOST.arch)@

Log in to reply