How to create a custom qmake conditional project

Suppose I am writing code on two computers that run different Linux distributions.

How to make qmake different from these two distributions and assign specific LIBS to these two.

For example:

unix: {

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

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

}

      

+3


source to share


1 answer


I think you can run "uname -a" and use a regex to test 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
}

      

+6


source







All Articles