Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt pro file conditional libs

I am trying to setup a pro file where I want it to only include a specific library if a variable is defined. I already have this variable passed into qmake via the command line by appending DEFINES+=VARIABLE_NAME.

I can use VARIABLE_NAME to conditionally compile parts of my code but can I have a condition to detect VARIABLE_NAME in the pro file and only include a library if it exists?

Thanks, Alan

like image 205
Alan Spark Avatar asked Sep 20 '25 12:09

Alan Spark


1 Answers

Something like that:

DEFINES += USELIB

contains(DEFINES, USELIB) {
  LIBS += SOMELIB
}
like image 120
dtech Avatar answered Sep 23 '25 03:09

dtech