KcFnMi
KcFnMi

Reputation: 6171

lib (release) or libd (debug), can Qt resolve this for me?

In the Plug & Paint Example the .pro presents the following:

LIBS           = -Lplugins -lpnp_basictools

if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
   mac:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)_debug
   win32:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)d
}

Which, for that particular case, appends a d to the lib name in debug mode, pnp_basictools becomes pnp_basictoolsd. But it doesn't scale well, i.e.:

LIBS           = -Lplugins -lplugin_1 -lplugin_2 -lplugin_3

if(!debug_and_release|build_pass):CONFIG(debug, debug|release)
   win32:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)d

Seems not to append d to plugin_2 and plugin_3.

So, may I ask for another method to add the d to the lib name in debug mode?

The issue was also mentioned here.

Upvotes: 0

Views: 109

Answers (1)

alexisdm
alexisdm

Reputation: 29886

$$member(X, pos) returns the item at the position pos of the list variable X. So, the code you found only handles 2 of the elements of that list (0 => -Lplugins and 1 => -lpnp_basictools).

There is a for loop that could help you handle all the elements of the list, but instead you can "simply" use a regular expression with the ~= operator :

win32:LIBS ~= s/-l(.*)/-l\1d/g

Upvotes: 1

Related Questions