summaryrefslogtreecommitdiffstats
path: root/test cases/cmake/3 advanced no dep/subprojects
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
commit7b6e527f440cd7e6f8be2b07cee320ee6ca18786 (patch)
tree4a2738d69fa2814659fdadddf5826282e73d81f4 /test cases/cmake/3 advanced no dep/subprojects
parentInitial commit. (diff)
downloadmeson-upstream.tar.xz
meson-upstream.zip
Adding upstream version 1.0.1.upstream/1.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test cases/cmake/3 advanced no dep/subprojects')
-rw-r--r--test cases/cmake/3 advanced no dep/subprojects/cmMod/CMakeLists.txt26
-rw-r--r--test cases/cmake/3 advanced no dep/subprojects/cmMod/config.h.in3
-rw-r--r--test cases/cmake/3 advanced no dep/subprojects/cmMod/lib/cmMod.cpp16
-rw-r--r--test cases/cmake/3 advanced no dep/subprojects/cmMod/lib/cmMod.hpp13
-rw-r--r--test cases/cmake/3 advanced no dep/subprojects/cmMod/main.cpp10
5 files changed, 68 insertions, 0 deletions
diff --git a/test cases/cmake/3 advanced no dep/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/3 advanced no dep/subprojects/cmMod/CMakeLists.txt
new file mode 100644
index 0000000..d738d45
--- /dev/null
+++ b/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/test cases/cmake/3 advanced no dep/subprojects/cmMod/config.h.in b/test cases/cmake/3 advanced no dep/subprojects/cmMod/config.h.in
new file mode 100644
index 0000000..f538ac9
--- /dev/null
+++ b/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/test cases/cmake/3 advanced no dep/subprojects/cmMod/lib/cmMod.cpp b/test cases/cmake/3 advanced no dep/subprojects/cmMod/lib/cmMod.cpp
new file mode 100644
index 0000000..741e8df
--- /dev/null
+++ b/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/test cases/cmake/3 advanced no dep/subprojects/cmMod/lib/cmMod.hpp b/test cases/cmake/3 advanced no dep/subprojects/cmMod/lib/cmMod.hpp
new file mode 100644
index 0000000..52f576b
--- /dev/null
+++ b/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/test cases/cmake/3 advanced no dep/subprojects/cmMod/main.cpp b/test cases/cmake/3 advanced no dep/subprojects/cmMod/main.cpp
new file mode 100644
index 0000000..d3e67ca
--- /dev/null
+++ b/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;
+}