parent
448b11cb7f
commit
e80ff985fb
9 changed files with 79 additions and 4 deletions
@ -0,0 +1,17 @@ |
||||
## Do not add custom target dir to header path if `implicit_include_directories` is `false` |
||||
|
||||
If you do the following: |
||||
|
||||
```meson |
||||
# in some subdirectory |
||||
gen_h = custom_target(...) |
||||
# in some other directory |
||||
executable('foo', 'foo.c', gen_h) |
||||
``` |
||||
|
||||
then the output directory of the custom target is automatically added |
||||
to the header search path. This is convenient, but sometimes it can |
||||
lead to problems. Starting with this version, the directory will no |
||||
longer be put in the search path if the target has |
||||
`implicit_include_directories: false`. In these cases you need to set |
||||
up the path manually with `include_directories`. |
@ -0,0 +1,7 @@ |
||||
#!/usr/bin/env python3 |
||||
|
||||
import sys |
||||
|
||||
f = open(sys.argv[1], 'w') |
||||
f.write('#define RETURN_VALUE 0') |
||||
f.close() |
@ -0,0 +1,3 @@ |
||||
genh = custom_target('header', |
||||
output: 'generated.h', |
||||
command: [find_program('genh.py'), '@OUTPUT@']) |
@ -0,0 +1,5 @@ |
||||
#include<generated.h> |
||||
|
||||
int func(void) { |
||||
return RETURN_VALUE; |
||||
} |
@ -0,0 +1,9 @@ |
||||
project('implicit custom dirs', 'c') |
||||
|
||||
subdir('easytogrepfor') |
||||
|
||||
l = static_library('helper', 'helper.c', genh) |
||||
d = declare_dependency(link_with: l, sources: genh) |
||||
executable('prog', 'prog.c', dependencies: d, implicit_include_directories: false) |
||||
|
||||
executable('prog2', 'prog2.c', dependencies: d) |
@ -0,0 +1,9 @@ |
||||
#include<stdlib.h> |
||||
|
||||
int func(void); |
||||
|
||||
int main(int argc, char **argv) { |
||||
(void)argc; |
||||
(void)(argv); |
||||
return func(); |
||||
} |
@ -0,0 +1,10 @@ |
||||
#include<stdlib.h> |
||||
#include<generated.h> |
||||
|
||||
int func(void); |
||||
|
||||
int main(int argc, char **argv) { |
||||
(void)argc; |
||||
(void)(argv); |
||||
return func() + RETURN_VALUE; |
||||
} |
Loading…
Reference in new issue