From af1a266670d040d2f4083ff309d732d648afba2a Mon Sep 17 00:00:00 2001 From: Angelos Mouzakitis Date: Tue, 10 Oct 2023 14:33:42 +0000 Subject: Add submodule dependency files Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec --- .../cmake/18 skip include files/main.cpp | 10 ++++++++ .../cmake/18 skip include files/meson.build | 9 +++++++ .../subprojects/cmMod/CMakeLists.txt | 15 +++++++++++ .../subprojects/cmMod/cmMod.cpp | 10 ++++++++ .../subprojects/cmMod/cmMod.hpp | 16 ++++++++++++ .../subprojects/cmMod/fakeInc/CMakeLists.txt | 30 ++++++++++++++++++++++ .../subprojects/cmMod/fakeInc/cmModInc1.cpp | 7 +++++ .../subprojects/cmMod/fakeInc/cmModInc2.cpp | 7 +++++ .../subprojects/cmMod/fakeInc/cmModInc3.cpp | 7 +++++ .../subprojects/cmMod/fakeInc/cmModInc4.cpp | 7 +++++ 10 files changed, 118 insertions(+) create mode 100644 meson/test cases/cmake/18 skip include files/main.cpp create mode 100644 meson/test cases/cmake/18 skip include files/meson.build create mode 100644 meson/test cases/cmake/18 skip include files/subprojects/cmMod/CMakeLists.txt create mode 100644 meson/test cases/cmake/18 skip include files/subprojects/cmMod/cmMod.cpp create mode 100644 meson/test cases/cmake/18 skip include files/subprojects/cmMod/cmMod.hpp create mode 100644 meson/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/CMakeLists.txt create mode 100644 meson/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc1.cpp create mode 100644 meson/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc2.cpp create mode 100644 meson/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc3.cpp create mode 100644 meson/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc4.cpp (limited to 'meson/test cases/cmake/18 skip include files') diff --git a/meson/test cases/cmake/18 skip include files/main.cpp b/meson/test cases/cmake/18 skip include files/main.cpp new file mode 100644 index 000000000..95079615a --- /dev/null +++ b/meson/test cases/cmake/18 skip include files/main.cpp @@ -0,0 +1,10 @@ +#include +#include + +using namespace std; + +int main(void) { + cmModClass obj("Hello"); + cout << obj.getStr() << endl; + return 0; +} diff --git a/meson/test cases/cmake/18 skip include files/meson.build b/meson/test cases/cmake/18 skip include files/meson.build new file mode 100644 index 000000000..b9a300c93 --- /dev/null +++ b/meson/test cases/cmake/18 skip include files/meson.build @@ -0,0 +1,9 @@ +project('cmakeSubTest', ['c', 'cpp']) + +cm = import('cmake') + +sub_pro = cm.subproject('cmMod') +sub_dep = sub_pro.dependency('cmModLib++') + +exe1 = executable('main', ['main.cpp'], dependencies: [sub_dep]) +test('test1', exe1) diff --git a/meson/test cases/cmake/18 skip include files/subprojects/cmMod/CMakeLists.txt b/meson/test cases/cmake/18 skip include files/subprojects/cmMod/CMakeLists.txt new file mode 100644 index 000000000..4db01b32d --- /dev/null +++ b/meson/test cases/cmake/18 skip include files/subprojects/cmMod/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmMod) +set (CMAKE_CXX_STANDARD 14) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +add_definitions("-DDO_NOTHING_JUST_A_FLAG=1") + +set(SRCS + ${CMAKE_CURRENT_LIST_DIR}/cmMod.hpp + ${CMAKE_CURRENT_LIST_DIR}/cmMod.cpp +) + +add_subdirectory(fakeInc) diff --git a/meson/test cases/cmake/18 skip include files/subprojects/cmMod/cmMod.cpp b/meson/test cases/cmake/18 skip include files/subprojects/cmMod/cmMod.cpp new file mode 100644 index 000000000..7551b756b --- /dev/null +++ b/meson/test cases/cmake/18 skip include files/subprojects/cmMod/cmMod.cpp @@ -0,0 +1,10 @@ +#include "cmMod.hpp" + +using namespace std; + +#define MESON_INCLUDE_IMPL +#include "fakeInc/cmModInc1.cpp" +#include "fakeInc/cmModInc2.cpp" +#include "fakeInc/cmModInc3.cpp" +#include "fakeInc/cmModInc4.cpp" +#undef MESON_INCLUDE_IMPL diff --git a/meson/test cases/cmake/18 skip include files/subprojects/cmMod/cmMod.hpp b/meson/test cases/cmake/18 skip include files/subprojects/cmMod/cmMod.hpp new file mode 100644 index 000000000..f7b780f11 --- /dev/null +++ b/meson/test cases/cmake/18 skip include files/subprojects/cmMod/cmMod.hpp @@ -0,0 +1,16 @@ +#pragma once + +#include "cmmodlib++_export.h" +#include + +class CMMODLIB___EXPORT cmModClass { +private: + std::string str; + + std::string getStr1() const; + std::string getStr2() const; +public: + cmModClass(std::string foo); + + std::string getStr() const; +}; diff --git a/meson/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/CMakeLists.txt b/meson/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/CMakeLists.txt new file mode 100644 index 000000000..39cd08003 --- /dev/null +++ b/meson/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/CMakeLists.txt @@ -0,0 +1,30 @@ +list(APPEND SRCS + cmModInc1.cpp + cmModInc2.cpp + cmModInc3.cpp + cmModInc4.cpp +) + +set(SRC_A + cmModInc1.cpp + ${CMAKE_CURRENT_LIST_DIR}/cmModInc2.cpp +) + +set_property( + SOURCE ${SRC_A} + PROPERTY + HEADER_FILE_ONLY ON +) + +set_source_files_properties( + cmModInc3.cpp + ${CMAKE_CURRENT_LIST_DIR}/cmModInc4.cpp + PROPERTIES + LABELS "CMake;Lists;are;fun" + HEADER_FILE_ONLY ON +) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +add_library(cmModLib++ SHARED ${SRCS}) +include(GenerateExportHeader) +generate_export_header(cmModLib++) diff --git a/meson/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc1.cpp b/meson/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc1.cpp new file mode 100644 index 000000000..b637755c3 --- /dev/null +++ b/meson/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc1.cpp @@ -0,0 +1,7 @@ +#ifndef MESON_INCLUDE_IMPL +#error "MESON_INCLUDE_IMPL is not defined" +#endif // !MESON_INCLUDE_IMPL + +cmModClass::cmModClass(string foo) { + str = foo + " World"; +} diff --git a/meson/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc2.cpp b/meson/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc2.cpp new file mode 100644 index 000000000..8a53567da --- /dev/null +++ b/meson/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc2.cpp @@ -0,0 +1,7 @@ +#ifndef MESON_INCLUDE_IMPL +#error "MESON_INCLUDE_IMPL is not defined" +#endif // !MESON_INCLUDE_IMPL + +string cmModClass::getStr() const { + return getStr2(); +} diff --git a/meson/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc3.cpp b/meson/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc3.cpp new file mode 100644 index 000000000..2c8ad125b --- /dev/null +++ b/meson/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc3.cpp @@ -0,0 +1,7 @@ +#ifndef MESON_INCLUDE_IMPL +#error "MESON_INCLUDE_IMPL is not defined" +#endif // !MESON_INCLUDE_IMPL + +string cmModClass::getStr1() const { + return getStr2(); +} diff --git a/meson/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc4.cpp b/meson/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc4.cpp new file mode 100644 index 000000000..78a067342 --- /dev/null +++ b/meson/test cases/cmake/18 skip include files/subprojects/cmMod/fakeInc/cmModInc4.cpp @@ -0,0 +1,7 @@ +#ifndef MESON_INCLUDE_IMPL +#error "MESON_INCLUDE_IMPL is not defined" +#endif // !MESON_INCLUDE_IMPL + +string cmModClass::getStr2() const { + return str; +} -- cgit 1.2.3-korg