diff options
author | Albert Astals Cid <albert.astals.cid@kdab.com> | 2019-02-12 10:07:57 +0100 |
---|---|---|
committer | Albert Astals Cid <albert.astals.cid@kdab.com> | 2019-02-12 09:24:31 +0000 |
commit | cfba14e1e9198f3b902e267e44b9f57d40920e1d (patch) | |
tree | 9f83738b345c1bbf84affbea5d582ee2af9e71bd /util | |
parent | 2e64ac90d8b71bf1afe4ae4af87096a3888ff3be (diff) |
configurejson2cmake.py: Support for the two cases that have LIBS +=
Since there's only two i hardcoded it for the moment instead of trying
to parse the line
Change-Id: I0da578af64ef9621cbbc78bf6ce15bf8a3f63f1c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'util')
-rwxr-xr-x | util/cmake/configurejson2cmake.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/util/cmake/configurejson2cmake.py b/util/cmake/configurejson2cmake.py index 7efeb88522..5357ccc44e 100755 --- a/util/cmake/configurejson2cmake.py +++ b/util/cmake/configurejson2cmake.py @@ -604,12 +604,32 @@ def parseTest(ctx, test, data, cm_fh): sourceCode = sourceCode.replace('"', '\\"') + librariesCmakeName = "" + qmakeFixme = "" + cm_fh.write("# {}\n".format(test)) + if "qmake" in details: # We don't really have many so we can just enumerate them all + if details["qmake"] == "unix:LIBS += -lpthread": + librariesCmakeName = format(test) + "_TEST_LIBRARIES" + cm_fh.write("if (UNIX)\n") + cm_fh.write(" set(" + librariesCmakeName + " pthread)\n") + cm_fh.write("endif()\n") + elif details["qmake"] == "linux: LIBS += -lpthread -lrt": + librariesCmakeName = format(test) + "_TEST_LIBRARIES" + cm_fh.write("if (LINUX)\n") + cm_fh.write(" set(" + librariesCmakeName + " pthread rt)\n") + cm_fh.write("endif()\n") + else: + qmakeFixme = "# FIXME: qmake: {}\n".format(details["qmake"]) + cm_fh.write("qt_config_compile_test({}\n".format(featureName(test))) cm_fh.write(lineify("LABEL", data.get("label", ""))) + if librariesCmakeName != "": + cm_fh.write(lineify("LIBRARIES", "${"+librariesCmakeName+"}")) + cm_fh.write(" CODE\n") cm_fh.write('"' + sourceCode + '"') - if "qmake" in details: - cm_fh.write("# FIXME: qmake: {}\n".format(details["qmake"])) + if qmakeFixme != "": + cm_fh.write(qmakeFixme) if "use" in data: cm_fh.write("# FIXME: use: {}\n".format(data["use"])) cm_fh.write(")\n\n") |