Question

Suppose I write code on 2 computers which runs different linux distros.

How to make qmake differ those two distros and assign specific LIBS for those two.

For instance;

unix: {

   ubuntu*: {
          LIBS += -lcxcore -lhighgui -lm
   }

   gentoo*: {
           LIBS += -lopencv_imgproc -lopencv_highgui -lm
   }

}
Was it helpful?

Solution

I think you can run "uname -a" and use a regular expression to check the return value in your .pro file:

UNAME = $$system(uname -a)

contains(UNAME, YourRegExpToMatchGentoo): GENTOO = 1
contains(UNAME, YourRegExpToMatchUbuntu): UBUNTU = 1

contains(GENTOO, 1): {
    LIBS += -lcxcore -lhighgui -lm
}

contains(UBUNTU, 1): {
    LIBS += -lopencv_imgproc -lopencv_highgui -lm
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top