diff --git a/test cases/common/49 subproject/meson.build b/test cases/common/49 subproject/meson.build new file mode 100644 index 000000000..fcb2c2dab --- /dev/null +++ b/test cases/common/49 subproject/meson.build @@ -0,0 +1,9 @@ +project('subproj user', 'c') + +sub = subproject('sublib') + +inc = sub.get_variable('i') +lib = sub.get_variable('l') + +e = executable('user.c', include_dirs : inc, link_with : lib) +test('subdirtest', e) diff --git a/test cases/common/49 subproject/sublib/include/subdefs.h b/test cases/common/49 subproject/sublib/include/subdefs.h new file mode 100644 index 000000000..9261c7833 --- /dev/null +++ b/test cases/common/49 subproject/sublib/include/subdefs.h @@ -0,0 +1,6 @@ +#ifndef SUBDEFS_H_ +#define SUBDEFS_H_ + +int subfunc(); + +#endif diff --git a/test cases/common/49 subproject/sublib/meson.build b/test cases/common/49 subproject/sublib/meson.build new file mode 100644 index 000000000..9ff3111c0 --- /dev/null +++ b/test cases/common/49 subproject/sublib/meson.build @@ -0,0 +1,6 @@ +project('subproject', 'c') + +i = include_directories('include') +l = shared_library('sublib', 'sublib.c', include_dirs : i, install : true) +t = executable('simpletest', 'simpletest.c', include_dirs : i, link_with : l) +test('plain', t) diff --git a/test cases/common/49 subproject/sublib/simpletest.c b/test cases/common/49 subproject/sublib/simpletest.c new file mode 100644 index 000000000..3801a40e9 --- /dev/null +++ b/test cases/common/49 subproject/sublib/simpletest.c @@ -0,0 +1,5 @@ +#include + +int main(int argc, char **argv) { + return subfunc() == 42 ? 0 : 1; +} diff --git a/test cases/common/49 subproject/sublib/sublib.c b/test cases/common/49 subproject/sublib/sublib.c new file mode 100644 index 000000000..7045c616f --- /dev/null +++ b/test cases/common/49 subproject/sublib/sublib.c @@ -0,0 +1,5 @@ +#include + +int subfunc() { + return 42; +} diff --git a/test cases/common/49 subproject/user.c b/test cases/common/49 subproject/user.c new file mode 100644 index 000000000..cfde532d8 --- /dev/null +++ b/test cases/common/49 subproject/user.c @@ -0,0 +1,16 @@ +#include +#include + + +int main(int argc, char **argv) { + int res; + printf("Calling into sublib now.\n"); + res = subfunc(); + if(res == 42) { + printf("Everything is fine.\n"); + return 0; + } else { + printf("Something went wrong.\n"); + return 1; + } +}