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>
This commit is contained in:
Albert Astals Cid 2019-02-12 10:07:57 +01:00
parent 2e64ac90d8
commit cfba14e1e9
2 changed files with 28 additions and 10 deletions

View File

@ -114,11 +114,11 @@ int pipes[2];
# cxx11_future
if (UNIX)
set(CXX11_FUTURE_TEST_LIBRARIES pthread)
set(cxx11_future_TEST_LIBRARIES pthread)
endif()
qt_config_compile_test(cxx11_future
LABEL "C++11 <future>"
LIBRARIES ${CXX11_FUTURE_TEST_LIBRARIES}
LIBRARIES "${cxx11_future_TEST_LIBRARIES}"
CODE
"
#include <future>
@ -132,8 +132,7 @@ std::future<int> f = std::async([]() { return 42; });
/* END TEST: */
return 0;
}
"
)
")
# eventfd
qt_config_compile_test(eventfd
@ -197,11 +196,11 @@ shmctl(0, 0, (struct shmid_ds *)(0));
# ipc_posix
if (LINUX)
set(IPC_POSIX_TEST_LIBRARIES pthread rt)
set(ipc_posix_TEST_LIBRARIES pthread rt)
endif()
qt_config_compile_test(ipc_posix
LABEL "POSIX IPC"
LIBRARIES ${IPC_POSIX_TEST_LIBRARIES}
LIBRARIES "${ipc_posix_TEST_LIBRARIES}"
CODE
"
#include <sys/types.h>
@ -219,8 +218,7 @@ shm_unlink(\"test\");
/* END TEST: */
return 0;
}
"
)
")
# linkat
qt_config_compile_test(linkat

View File

@ -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")