Added test for declare_dependency.

This commit is contained in:
Jussi Pakkanen 2015-07-12 13:43:30 +03:00
parent 0da1fbcb98
commit 1d4af5c84e
6 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,4 @@
#pragma once
int entity_func1();
int entity_func2();

View File

@ -0,0 +1,5 @@
#include"entity.h"
int entity_func1() {
return 5;
}

View File

@ -0,0 +1,5 @@
#include<entity.h>
int entity_func2() {
return 9;
}

View File

@ -0,0 +1,5 @@
entity_lib = static_library('entity', 'entity1.c')
entity_dep = declare_dependency(link_with : entity_lib,
include_directories : include_directories('.'),
sources : 'entity2.c')

View File

@ -0,0 +1,14 @@
#include<entity.h>
#include<stdio.h>
int main(int argc, char **argv) {
if(entity_func1() != 5) {
printf("Error in func1.\n");
return 1;
}
if(entity_func2() != 9) {
printf("Error in func2.\n");
return 2;
}
return 0;
}

View File

@ -0,0 +1,7 @@
project('declare dependency', 'c')
subdir('entity')
exe = executable('dep_user', 'main.c',
dependencies : entity_dep)
test('dep', exe)