aboutsummaryrefslogtreecommitdiffstats
path: root/meson/test cases/cmake/3 advanced no dep/subprojects/cmMod
diff options
context:
space:
mode:
authorAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
committerAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
commitaf1a266670d040d2f4083ff309d732d648afba2a (patch)
tree2fc46203448ddcc6f81546d379abfaeb323575e9 /meson/test cases/cmake/3 advanced no dep/subprojects/cmMod
parente02cda008591317b1625707ff8e115a4841aa889 (diff)
Add submodule dependency filesHEADmaster
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'meson/test cases/cmake/3 advanced no dep/subprojects/cmMod')
-rw-r--r--meson/test cases/cmake/3 advanced no dep/subprojects/cmMod/CMakeLists.txt26
-rw-r--r--meson/test cases/cmake/3 advanced no dep/subprojects/cmMod/config.h.in3
-rw-r--r--meson/test cases/cmake/3 advanced no dep/subprojects/cmMod/lib/cmMod.cpp16
-rw-r--r--meson/test cases/cmake/3 advanced no dep/subprojects/cmMod/lib/cmMod.hpp13
-rw-r--r--meson/test cases/cmake/3 advanced no dep/subprojects/cmMod/main.cpp10
5 files changed, 68 insertions, 0 deletions
diff --git a/meson/test cases/cmake/3 advanced no dep/subprojects/cmMod/CMakeLists.txt b/meson/test cases/cmake/3 advanced no dep/subprojects/cmMod/CMakeLists.txt
new file mode 100644
index 000000000..d738d45c9
--- /dev/null
+++ b/meson/test cases/cmake/3 advanced no dep/subprojects/cmMod/CMakeLists.txt
@@ -0,0 +1,26 @@
+cmake_minimum_required(VERSION 3.5)
+
+project(cmMod)
+set(CMAKE_CXX_STANDARD 14)
+
+include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/lib)
+
+set(CONFIG_OPT 42)
+configure_file("config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.h" @ONLY)
+
+add_library(cmModLib SHARED lib/cmMod.cpp)
+add_library(cmModLibStatic STATIC lib/cmMod.cpp)
+include(GenerateExportHeader)
+generate_export_header(cmModLib)
+
+set_target_properties(cmModLib PROPERTIES VERSION 1.0.1)
+
+add_executable(meson-testEXE main.cpp)
+add_executable(benchmark main.cpp)
+
+target_link_libraries(meson-testEXE cmModLib)
+target_link_libraries(benchmark cmModLib)
+
+target_compile_definitions(cmModLibStatic PUBLIC CMMODLIB_STATIC_DEFINE)
+
+install(TARGETS meson-testEXE benchmark LIBRARY DESTINATION lib RUNTIME DESTINATION bin)
diff --git a/meson/test cases/cmake/3 advanced no dep/subprojects/cmMod/config.h.in b/meson/test cases/cmake/3 advanced no dep/subprojects/cmMod/config.h.in
new file mode 100644
index 000000000..f538ac985
--- /dev/null
+++ b/meson/test cases/cmake/3 advanced no dep/subprojects/cmMod/config.h.in
@@ -0,0 +1,3 @@
+#pragma once
+
+#define CONFIG_OPT @CONFIG_OPT@
diff --git a/meson/test cases/cmake/3 advanced no dep/subprojects/cmMod/lib/cmMod.cpp b/meson/test cases/cmake/3 advanced no dep/subprojects/cmMod/lib/cmMod.cpp
new file mode 100644
index 000000000..741e8dff0
--- /dev/null
+++ b/meson/test cases/cmake/3 advanced no dep/subprojects/cmMod/lib/cmMod.cpp
@@ -0,0 +1,16 @@
+#include "cmMod.hpp"
+#include "config.h"
+
+#if CONFIG_OPT != 42
+#error "Invalid value of CONFIG_OPT"
+#endif
+
+using namespace std;
+
+cmModClass::cmModClass(string foo) {
+ str = foo + " World";
+}
+
+string cmModClass::getStr() const {
+ return str;
+}
diff --git a/meson/test cases/cmake/3 advanced no dep/subprojects/cmMod/lib/cmMod.hpp b/meson/test cases/cmake/3 advanced no dep/subprojects/cmMod/lib/cmMod.hpp
new file mode 100644
index 000000000..52f576bf3
--- /dev/null
+++ b/meson/test cases/cmake/3 advanced no dep/subprojects/cmMod/lib/cmMod.hpp
@@ -0,0 +1,13 @@
+#pragma once
+
+#include <string>
+#include "cmmodlib_export.h"
+
+class CMMODLIB_EXPORT cmModClass {
+ private:
+ std::string str;
+ public:
+ cmModClass(std::string foo);
+
+ std::string getStr() const;
+};
diff --git a/meson/test cases/cmake/3 advanced no dep/subprojects/cmMod/main.cpp b/meson/test cases/cmake/3 advanced no dep/subprojects/cmMod/main.cpp
new file mode 100644
index 000000000..d3e67ca32
--- /dev/null
+++ b/meson/test cases/cmake/3 advanced no dep/subprojects/cmMod/main.cpp
@@ -0,0 +1,10 @@
+#include <iostream>
+#include "lib/cmMod.hpp"
+
+using namespace std;
+
+int main(void) {
+ cmModClass obj("Hello (LIB TEST)");
+ cout << obj.getStr() << endl;
+ return 0;
+}