diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2018-06-15 17:44:58 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2018-06-20 08:26:08 +0000 |
commit | 4764e3eb961013e169c155648f26b0e63eb2b574 (patch) | |
tree | a1b761e77188b98eaf8fdba251f18fcc75822696 /tests/auto/blackbox/testdata-apple | |
parent | 5a8e20fe51e95ac5ab97c4c691a3c194383cff55 (diff) | |
download | qbs-4764e3eb961013e169c155648f26b0e63eb2b574.tar.gz |
Don't link to multiplexed libraries when depending on the aggregate
... library, this can lead to warnings or linker errors. Most easily
seen on macOS when multiplexing across multiple architectures,
and an app ends up linking against multiple multiplexed variants of
a dependent product library.
Change-Id: I4ea4b419099a1010f7b8c32ee11079da93f1d236
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'tests/auto/blackbox/testdata-apple')
3 files changed, 55 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata-apple/aggregateDependencyLinking/aggregateDependencyLinking.qbs b/tests/auto/blackbox/testdata-apple/aggregateDependencyLinking/aggregateDependencyLinking.qbs new file mode 100644 index 000000000..e7c8867bd --- /dev/null +++ b/tests/auto/blackbox/testdata-apple/aggregateDependencyLinking/aggregateDependencyLinking.qbs @@ -0,0 +1,35 @@ +import qbs + +Project { + minimumQbsVersion: "1.8" + + StaticLibrary { + name: "multi_arch_lib" + files: ["lib.c"] + + Depends { name: "cpp" } + Depends { name: "bundle" } + bundle.isBundle: false + + // This will generate 2 multiplex configs and an aggregate. + qbs.architectures: ["x86", "x86_64"] + qbs.buildVariant: "debug" + } + + CppApplication { + name: "just_app" + files: ["app.c"] + + // This should link only against the aggregate static library, and not against + // the {debug, x86_64} variant, or worse - against both the single arch variant + // and the lipo-ed one. + Depends { name: "multi_arch_lib" } + + Depends { name: "bundle" } + bundle.isBundle: false + + qbs.architecture: "x86_64" + qbs.buildVariant: "debug" + multiplexByQbsProperties: [] + } +} diff --git a/tests/auto/blackbox/testdata-apple/aggregateDependencyLinking/app.c b/tests/auto/blackbox/testdata-apple/aggregateDependencyLinking/app.c new file mode 100644 index 000000000..ae414324b --- /dev/null +++ b/tests/auto/blackbox/testdata-apple/aggregateDependencyLinking/app.c @@ -0,0 +1,8 @@ +extern int foo(); + +int main(int argc, char *argv[]) { + (void) argc; + (void) argv; + + return foo(); +} diff --git a/tests/auto/blackbox/testdata-apple/aggregateDependencyLinking/lib.c b/tests/auto/blackbox/testdata-apple/aggregateDependencyLinking/lib.c new file mode 100644 index 000000000..9ef95547b --- /dev/null +++ b/tests/auto/blackbox/testdata-apple/aggregateDependencyLinking/lib.c @@ -0,0 +1,12 @@ +#include <stdio.h> + +int foo() +{ +#ifdef __i386__ + printf("Hello from i386\n"); +#endif +#ifdef __x86_64__ + printf("Hello from x86_64\n"); +#endif + return 0; +} |