From 7b6e527f440cd7e6f8be2b07cee320ee6ca18786 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 29 Apr 2024 06:41:38 +0200 Subject: Adding upstream version 1.0.1. Signed-off-by: Daniel Baumann --- test cases/cmake/5 object library/main.cpp | 11 +++++++++++ test cases/cmake/5 object library/meson.build | 21 +++++++++++++++++++++ .../subprojects/cmObjLib/CMakeLists.txt | 11 +++++++++++ .../5 object library/subprojects/cmObjLib/libA.cpp | 5 +++++ .../5 object library/subprojects/cmObjLib/libA.hpp | 16 ++++++++++++++++ .../5 object library/subprojects/cmObjLib/libB.cpp | 6 ++++++ .../5 object library/subprojects/cmObjLib/libB.hpp | 16 ++++++++++++++++ 7 files changed, 86 insertions(+) create mode 100644 test cases/cmake/5 object library/main.cpp create mode 100644 test cases/cmake/5 object library/meson.build create mode 100644 test cases/cmake/5 object library/subprojects/cmObjLib/CMakeLists.txt create mode 100644 test cases/cmake/5 object library/subprojects/cmObjLib/libA.cpp create mode 100644 test cases/cmake/5 object library/subprojects/cmObjLib/libA.hpp create mode 100644 test cases/cmake/5 object library/subprojects/cmObjLib/libB.cpp create mode 100644 test cases/cmake/5 object library/subprojects/cmObjLib/libB.hpp (limited to 'test cases/cmake/5 object library') diff --git a/test cases/cmake/5 object library/main.cpp b/test cases/cmake/5 object library/main.cpp new file mode 100644 index 0000000..9933ab4 --- /dev/null +++ b/test cases/cmake/5 object library/main.cpp @@ -0,0 +1,11 @@ +#include +#include +#include "libA.hpp" +#include "libB.hpp" + +using namespace std; + +int main(void) { + cout << getLibStr() << " -- " << getZlibVers() << endl; + return EXIT_SUCCESS; +} diff --git a/test cases/cmake/5 object library/meson.build b/test cases/cmake/5 object library/meson.build new file mode 100644 index 0000000..f38a2dd --- /dev/null +++ b/test cases/cmake/5 object library/meson.build @@ -0,0 +1,21 @@ +project('cmake_object_lib_test', ['c', 'cpp']) + +dep_test = dependency('ZLIB', method: 'cmake', required: false) +if not dep_test.found() + error('MESON_SKIP_TEST: zlib is not installed') +endif + +cm = import('cmake') + +sub_pro = cm.subproject('cmObjLib') +sub_sha = sub_pro.dependency('lib_sha') +sub_sta = sub_pro.dependency('lib_sta') + +# Required for the static library +zlib_dep = dependency('zlib') + +exe_sha = executable('shared', ['main.cpp'], dependencies: [sub_sha]) +exe_sta = executable('static', ['main.cpp'], dependencies: [sub_sta, zlib_dep]) + +test('test1', exe_sha) +test('test1', exe_sta) diff --git a/test cases/cmake/5 object library/subprojects/cmObjLib/CMakeLists.txt b/test cases/cmake/5 object library/subprojects/cmObjLib/CMakeLists.txt new file mode 100644 index 0000000..062496e --- /dev/null +++ b/test cases/cmake/5 object library/subprojects/cmObjLib/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.7) +project(cmObject CXX) + +find_package(ZLIB REQUIRED) + +add_library(lib_obj OBJECT libA.cpp libB.cpp) +add_library(lib_sha SHARED $) +add_library(lib_sta STATIC $) + +target_link_libraries(lib_sha ZLIB::ZLIB) +target_link_libraries(lib_sta ZLIB::ZLIB) diff --git a/test cases/cmake/5 object library/subprojects/cmObjLib/libA.cpp b/test cases/cmake/5 object library/subprojects/cmObjLib/libA.cpp new file mode 100644 index 0000000..1d579cf --- /dev/null +++ b/test cases/cmake/5 object library/subprojects/cmObjLib/libA.cpp @@ -0,0 +1,5 @@ +#include "libA.hpp" + +std::string getLibStr(void) { + return "Hello World"; +} diff --git a/test cases/cmake/5 object library/subprojects/cmObjLib/libA.hpp b/test cases/cmake/5 object library/subprojects/cmObjLib/libA.hpp new file mode 100644 index 0000000..84b7bc7 --- /dev/null +++ b/test cases/cmake/5 object library/subprojects/cmObjLib/libA.hpp @@ -0,0 +1,16 @@ +#pragma once + +#include + +#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/test cases/cmake/5 object library/subprojects/cmObjLib/libB.cpp b/test cases/cmake/5 object library/subprojects/cmObjLib/libB.cpp new file mode 100644 index 0000000..22fe7c2 --- /dev/null +++ b/test cases/cmake/5 object library/subprojects/cmObjLib/libB.cpp @@ -0,0 +1,6 @@ +#include "libB.hpp" +#include + +std::string getZlibVers(void) { + return zlibVersion(); +} diff --git a/test cases/cmake/5 object library/subprojects/cmObjLib/libB.hpp b/test cases/cmake/5 object library/subprojects/cmObjLib/libB.hpp new file mode 100644 index 0000000..52ccc16 --- /dev/null +++ b/test cases/cmake/5 object library/subprojects/cmObjLib/libB.hpp @@ -0,0 +1,16 @@ +#pragma once + +#include + +#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(); -- cgit v1.2.3