Search code examples
macosqtqmake

qmake "system" command sometime returns empty string rather than the real response


I use, or perhaps abuse, the "system" command of qmake a lot in scripts interpreted by Qt Creator. As an example the command

RESPONSE = $$system(ls)

will in OSX populate the stringlist RESPONSE with the content of the working dir. After that a lot of string manipulation with RESPONSE can be done inside qmake.

However I noticed that with the Xcode utilities like "codesign" there is a system response (as shown in the "Compile Window" in Qt Creator) but the response is not put in RESPONSE.

Is there a way to get to get hold of the response of utilities like codesign inside qmake?


Solution

  • These utilities output to stderr, not stdout. You'll need to run them in a shell wrapper that redirects stderr to stdout, like bash -c 'codesign ... 2>&1'