diff options
author | Christian Kandeler <christian.kandeler@theqtcompany.com> | 2016-05-19 13:32:44 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@theqtcompany.com> | 2016-05-20 12:44:12 +0000 |
commit | 3872137a82d7abe17e9ebc9af4298c324f9a1003 (patch) | |
tree | ac5c66f9dedb1ed51619c953c5edcf0148aed38d /tests/auto/blackbox/testdata/conditional-export | |
parent | fbf6502160988e0376c26d83732329b226465f27 (diff) |
Respect the conditions of Export items.
This did not happen before, because module conditions are only evaluated
when loading the module file, of which there is none in the case of
Export items.
Note: The implementation assumes that the condition of an Export item
has the semantics "use or ignore this Export item". The other possible
meaning would be to use the condition as the condition of the resulting
module instance, but that immediately leads to weirdness: What does it
mean for the dependency to a product if said product is enabled, but its
Export item is not? What about conflicting conditions in the Export
items of an inheritance chain -- do they get logically "and"ed? And so
on.
Change-Id: I08d7d93d30b8a53b42a317cb3391924e4666d169
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests/auto/blackbox/testdata/conditional-export')
-rw-r--r-- | tests/auto/blackbox/testdata/conditional-export/conditional-export.qbs | 18 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata/conditional-export/main.cpp | 5 |
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/conditional-export/conditional-export.qbs b/tests/auto/blackbox/testdata/conditional-export/conditional-export.qbs new file mode 100644 index 000000000..c7b6ae09d --- /dev/null +++ b/tests/auto/blackbox/testdata/conditional-export/conditional-export.qbs @@ -0,0 +1,18 @@ +import qbs + +Project { + property bool enableExport: false + Product { + name: "dep" + Export { + condition: project.enableExport + Depends { name: "cpp" } + cpp.defines: ["THE_DEFINE"] + } + } + CppApplication { + name: "theProduct" + Depends { name: "dep" } + files: "main.cpp" + } +} diff --git a/tests/auto/blackbox/testdata/conditional-export/main.cpp b/tests/auto/blackbox/testdata/conditional-export/main.cpp new file mode 100644 index 000000000..d1c1982b0 --- /dev/null +++ b/tests/auto/blackbox/testdata/conditional-export/main.cpp @@ -0,0 +1,5 @@ +#ifndef THE_DEFINE +#error "missing define" +#endif + +int main() { } |