diff options
author | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
---|---|---|
committer | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /meson/test cases/cmake/24 mixing languages | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'meson/test cases/cmake/24 mixing languages')
6 files changed, 49 insertions, 0 deletions
diff --git a/meson/test cases/cmake/24 mixing languages/main.c b/meson/test cases/cmake/24 mixing languages/main.c new file mode 100644 index 000000000..028a78ea6 --- /dev/null +++ b/meson/test cases/cmake/24 mixing languages/main.c @@ -0,0 +1,5 @@ +#include <cmTest.h> + +int main(void) { + return doStuff(); +} diff --git a/meson/test cases/cmake/24 mixing languages/meson.build b/meson/test cases/cmake/24 mixing languages/meson.build new file mode 100644 index 000000000..4ab1d8542 --- /dev/null +++ b/meson/test cases/cmake/24 mixing languages/meson.build @@ -0,0 +1,13 @@ +project('CMake mix', ['c', 'cpp']) + +if not add_languages('objc', required : false) + error('MESON_SKIP_TEST: No ObjC compiler') +endif + +cm = import('cmake') + +sub_pro = cm.subproject('cmTest') +sub_dep = sub_pro.dependency('cmTest', include_type: 'system') + +exe1 = executable('exe1', ['main.c'], dependencies: [sub_dep]) +test('test1', exe1) diff --git a/meson/test cases/cmake/24 mixing languages/subprojects/cmTest/CMakeLists.txt b/meson/test cases/cmake/24 mixing languages/subprojects/cmTest/CMakeLists.txt new file mode 100644 index 000000000..80a256f0d --- /dev/null +++ b/meson/test cases/cmake/24 mixing languages/subprojects/cmTest/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmTest) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +add_library(cmTest STATIC cmTest.c cmTest.m) +target_compile_definitions(cmTest PUBLIC SOME_MAGIC_DEFINE=42) diff --git a/meson/test cases/cmake/24 mixing languages/subprojects/cmTest/cmTest.c b/meson/test cases/cmake/24 mixing languages/subprojects/cmTest/cmTest.c new file mode 100644 index 000000000..066d67671 --- /dev/null +++ b/meson/test cases/cmake/24 mixing languages/subprojects/cmTest/cmTest.c @@ -0,0 +1,13 @@ +#include "cmTest.h" +#include <stdio.h> + +#if SOME_MAGIC_DEFINE != 42 +#error "SOME_MAGIC_DEFINE != 42" +#endif + +int foo(int x); + +int doStuff(void) { + printf("Hello World\n"); + return foo(42); +} diff --git a/meson/test cases/cmake/24 mixing languages/subprojects/cmTest/cmTest.h b/meson/test cases/cmake/24 mixing languages/subprojects/cmTest/cmTest.h new file mode 100644 index 000000000..a6a5c242e --- /dev/null +++ b/meson/test cases/cmake/24 mixing languages/subprojects/cmTest/cmTest.h @@ -0,0 +1,3 @@ +#pragma once + +int doStuff(void); diff --git a/meson/test cases/cmake/24 mixing languages/subprojects/cmTest/cmTest.m b/meson/test cases/cmake/24 mixing languages/subprojects/cmTest/cmTest.m new file mode 100644 index 000000000..16ec8056d --- /dev/null +++ b/meson/test cases/cmake/24 mixing languages/subprojects/cmTest/cmTest.m @@ -0,0 +1,7 @@ +#if SOME_MAGIC_DEFINE != 42 +#error "SOME_MAGIC_DEFINE != 42" +#endif + +int foo(int x) { + return 42 - x; +} |