Javascriptimport qbs CppApplication { type: "application" // To suppress bundle generation on Mac consoleApplication: true property bool def3: true cpp.staticLibraries: ["stdc++"] files: "main.cpp" cpp.defines: ["DEF1", "DEF2"] Group { // Properties for the produced executable fileTagsFilter: product.type qbs.install: true } Properties { condition: def3 == true cpp.defines: base.concat([ "DEF3" ]) }}
C++ (Qt)#include <iostream> using namespace std; int main(){ cout << "Hello World!" << endl;#ifdef DEF1 cout << "def1" << endl;#endif #ifdef DEF2 cout << "def2" << endl;#endif #ifdef DEF3 cout << "def3" << endl;#endif return 0;}
C++ (Qt)while(!asleep()) sheep++;
Javascriptimport qbs CppApplication { type: "application" // To suppress bundle generation on Mac consoleApplication: true property bool def3: true cpp.staticLibraries: ["stdc++"] files: "main.cpp" cpp.defines: { var defines = ["DEF1", "DEF2"]; if (def3) { defines = defines.concat(["DEF3"]); } return defines; } Group { // Properties for the produced executable fileTagsFilter: product.type qbs.install: true } }
Properties { condition: def3 == true cpp.defines: outer.concat([ "DEF3" ]) }
Javascriptimport qbs CppApplication { type: "application" // To suppress bundle generation on Mac consoleApplication: true property bool def3: true property bool def4: true cpp.staticLibraries: ["stdc++"] files: ["main.cpp"] cpp.defines: ["DEF1", "DEF2"] Properties { condition: def3 == true cpp.defines: outer.concat([ "DEF3" ]) } Properties { condition: def4 == true cpp.defines: outer.concat([ "DEF4" ]) } Group { // Properties for the produced executable fileTagsFilter: product.type qbs.install: true } }
Product { name: "ambiguous_properties" Depends { id: cpp; name: "dummy" } cpp.defines: ["ONE"] Properties { condition: true cpp.defines: outer.concat(["TWO"]) } Properties { condition: false cpp.defines: outer.concat(["IMPOSSIBLE"]) } Properties { // will be ignored condition: true cpp.defines: outer.concat(["THREE"]) } }
property baseDefines: ["DEF1", "DEF2"] Properties { condition: true cpp.defines: baseDefines.concat(["DEF3"]) } Properties { condition: true cpp.defines: baseDefines.concat(["DEF4"]) } cpp.defines: baseDefines
JavascriptGroup { condition: def3 == true cpp.defines: outer.concat([ "DEF3" ]) }