Using QT_SYSROOT or CMAKE_SYSROOT in .pro file



  • what I'm doing is an app that will run on both Raspberry Pi and on desktop - linux also
    so I can't use

    win32 {
    my stuff here
    }
    

    or

    linux {
    also other stuff here - for linux only
    }
    

    I've tried

    RPI3 {
     my stuff
    }
    

    but it does not exist...

    so my next try was to detect the sysroot - this is different between desktop and Pi. but how can I do it?
    I've tested something like

    contains([QT_SYSROOT], /home/user/raspi/sysroot){
        message(I'm in Pi 1)
    }
    
    contains([CMAKE_SYSROOT], /home/user/raspi/sysroot){
        message(I'm in Pi 2)
    }
    
    
    contains(QT_SYSROOT, /home/user/raspi/sysroot){
        message(I'm in Pi 3)
    }
    
    contains(CMAKE_SYSROOT, /home/user/raspi/sysroot){
        message(I'm in Pi 4)
    }
    
    message(I'm out)
    

    None of them is working. what do I miss?? Is always printing: "I'm out"


  • Lifetime Qt Champion

    Hi,

    IIRC, the linux-rasp-pi* scope should do what you want.

    Hope it helps



  • @SGaist said in Using QT_SYSROOT or CMAKE_SYSROOT in .pro file:

    linux-rasp-pi*

    tried like that

    linux-rasp-pi*{
        message("working???")
    }
    

    and I'm getting this message even when I'm doing for desktop (Ubuntu Linux)



  • Here you have a working code.. after a lot of research:

    MY_QT_INSTALL_PREFIX=$$[QT_INSTALL_PREFIX]
    equals(MY_QT_INSTALL_PREFIX,"/home/andrei/raspi/qt5pi"){
        message($$[QT_INSTALL_PREFIX])
        message("Is Raspberry")
        target.path = /home/pi/myApp
        INSTALLS += target
    }
    
    # other stuff here
    

Log in to reply
 

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