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/6 object library no dep | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'meson/test cases/cmake/6 object library no dep')
7 files changed, 72 insertions, 0 deletions
diff --git a/meson/test cases/cmake/6 object library no dep/main.cpp b/meson/test cases/cmake/6 object library no dep/main.cpp new file mode 100644 index 000000000..9933ab457 --- /dev/null +++ b/meson/test cases/cmake/6 object library no dep/main.cpp @@ -0,0 +1,11 @@ +#include <stdlib.h> +#include <iostream> +#include "libA.hpp" +#include "libB.hpp" + +using namespace std; + +int main(void) { + cout << getLibStr() << " -- " << getZlibVers() << endl; + return EXIT_SUCCESS; +} diff --git a/meson/test cases/cmake/6 object library no dep/meson.build b/meson/test cases/cmake/6 object library no dep/meson.build new file mode 100644 index 000000000..65b8700b4 --- /dev/null +++ b/meson/test cases/cmake/6 object library no dep/meson.build @@ -0,0 +1,13 @@ +project('cmake_object_lib_test', 'cpp') + +cm = import('cmake') + +sub_pro = cm.subproject('cmObjLib') +sub_sha = sub_pro.dependency('lib_sha') +sub_sta = sub_pro.dependency('lib_sta') + +exe_sha = executable('shared', ['main.cpp'], dependencies: [sub_sha]) +exe_sta = executable('static', ['main.cpp'], dependencies: [sub_sta]) + +test('test1', exe_sha) +test('test1', exe_sta) diff --git a/meson/test cases/cmake/6 object library no dep/subprojects/cmObjLib/CMakeLists.txt b/meson/test cases/cmake/6 object library no dep/subprojects/cmObjLib/CMakeLists.txt new file mode 100644 index 000000000..9e136af1b --- /dev/null +++ b/meson/test cases/cmake/6 object library no dep/subprojects/cmObjLib/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.7) +project(cmObject CXX) + +add_library(lib_obj OBJECT libA.cpp libB.cpp) +add_library(lib_sha SHARED $<TARGET_OBJECTS:lib_obj>) +add_library(lib_sta STATIC $<TARGET_OBJECTS:lib_obj>) diff --git a/meson/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libA.cpp b/meson/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libA.cpp new file mode 100644 index 000000000..1d579cfdd --- /dev/null +++ b/meson/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libA.cpp @@ -0,0 +1,5 @@ +#include "libA.hpp" + +std::string getLibStr(void) { + return "Hello World"; +} diff --git a/meson/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libA.hpp b/meson/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libA.hpp new file mode 100644 index 000000000..84b7bc7d3 --- /dev/null +++ b/meson/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libA.hpp @@ -0,0 +1,16 @@ +#pragma once + +#include <string> + +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +std::string DLL_PUBLIC getLibStr(); diff --git a/meson/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libB.cpp b/meson/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libB.cpp new file mode 100644 index 000000000..aa44816d5 --- /dev/null +++ b/meson/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libB.cpp @@ -0,0 +1,5 @@ +#include "libB.hpp" + +std::string getZlibVers(void) { + return "STUB"; +} diff --git a/meson/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libB.hpp b/meson/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libB.hpp new file mode 100644 index 000000000..52ccc1601 --- /dev/null +++ b/meson/test cases/cmake/6 object library no dep/subprojects/cmObjLib/libB.hpp @@ -0,0 +1,16 @@ +#pragma once + +#include <string> + +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +std::string DLL_PUBLIC getZlibVers(); |