Details
Description
According to the documentation of Properties (http://qt-project.org/doc/qbs-1.1/properties-item.html), the following part
Properties { condition: qbs.targetOS.contains("windows") cpp.defines [ "ON_WINDOWS" ] } Properties { condition: qbs.targetOS.contains("linux") cpp.defines [ "ON_LINUX" ] }
is equivalent to
Properties { cpp.defines: { if (qbs.targetOS.contains("windows")) return ["ON_WINDOWS"]; if (qbs.targetOS.contains("linux")) return ["ON_LINUX"]; } }
I expected the same beaviour for Group, but this is not the case. For example, I want to install a additional library, which are different files on Windows and Linux. In my case, the Windows file (.dll) exists on the Windows System, but not on the Linux system and the Linux file (.so) exists on the Linux System but not on the Windows System. If I have the following part in my qbs file it fails:
Group { condition: qbs.targetOS.contains("linux") qbs.install: true files: [ "libSomething.so" ] } Group { condition: qbs.targetOS.contains("windows") qbs.install: true files: [ "something.dll" ] }
In Windows, I get the error that the .so file does not exist and on Linux that the .dll not exists. But if I use the following syntax:
Group { qbs.install: true files: { if (qbs.targetOS.contains("windows")) { return ["something.dll"] } if (qbs.targetOS.contains("linux")) { return ["libSomething.so"] } }
it works, as expected, without errors. This means that the two versions are NOT equivalent. I think the body of a group with a false condition should be ignored by qbs.