Test that add_project_dependencies() can only be used before build targets have been declared. Also test that one cannot use override_dependency on a superproject to inject a superproject's build products into the subproject. This would violate the rule that build products cannot be used with add_project_dependencies() (similar to e.g. compiler.has_function), so check that meson detects the situation correctly.pull/10347/head
parent
3a960023d3
commit
2f68aa21e8
10 changed files with 53 additions and 0 deletions
@ -0,0 +1,2 @@ |
||||
#pragma once |
||||
void f(void); |
@ -0,0 +1,3 @@ |
||||
#include <stdio.h> |
||||
#include "lib.h" |
||||
void f() {puts("hello");} |
@ -0,0 +1,8 @@ |
||||
project('super', 'c') |
||||
|
||||
inc = include_directories('inc') |
||||
lib = static_library('sneaky', 'lib.c', include_directories: inc) |
||||
meson.override_dependency('sneaky', |
||||
declare_dependency(link_with: lib, include_directories: inc)) |
||||
|
||||
subproject('a') |
@ -0,0 +1,10 @@ |
||||
project('a', 'c') |
||||
|
||||
dep = dependency('sneaky') |
||||
|
||||
# does not work |
||||
add_project_dependencies(dep, language: 'c') |
||||
executable('prog', 'prog.c') |
||||
|
||||
# this would work instead: |
||||
# executable('prog', 'prog.c', dependencies: dep) |
@ -0,0 +1,6 @@ |
||||
#include "lib.h" |
||||
|
||||
int main() { |
||||
f(); |
||||
return 0; |
||||
} |
@ -0,0 +1,7 @@ |
||||
{ |
||||
"stdout": [ |
||||
{ |
||||
"line": "test cases/failing/124 override and add_project_dependency/subprojects/a/meson.build:6:0: ERROR: Dependencies must be external dependencies" |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,2 @@ |
||||
#pragma once |
||||
void f(void); |
@ -0,0 +1,3 @@ |
||||
#include <stdio.h> |
||||
#include "lib.h" |
||||
void f() {puts("hello");} |
@ -0,0 +1,5 @@ |
||||
project('test', 'c') |
||||
|
||||
static_library('lib', 'lib.c') |
||||
inc = include_directories('inc') |
||||
add_project_dependencies(declare_dependency(include_directories: inc), language: 'c') |
@ -0,0 +1,7 @@ |
||||
{ |
||||
"stdout": [ |
||||
{ |
||||
"line": "test cases/failing/125 targets before add_project_dependency/meson.build:5:0: ERROR: Tried to use 'add_project_dependencies' after a build target has been declared." |
||||
} |
||||
] |
||||
} |
Loading…
Reference in new issue