Qt World Summit: Register Today!

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


    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


    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:


    tried like that


    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:

        message("Is Raspberry")
        target.path = /home/pi/myApp
        INSTALLS += target
    # other stuff here

Log in to reply