summaryrefslogtreecommitdiffstats
path: root/test cases/cmake/19 advanced options/subprojects
diff options
context:
space:
mode:
Diffstat (limited to 'test cases/cmake/19 advanced options/subprojects')
-rw-r--r--test cases/cmake/19 advanced options/subprojects/cmOpts/CMakeLists.txt18
-rw-r--r--test cases/cmake/19 advanced options/subprojects/cmOpts/cmMod.cpp31
-rw-r--r--test cases/cmake/19 advanced options/subprojects/cmOpts/cmMod.hpp14
-rw-r--r--test cases/cmake/19 advanced options/subprojects/cmOpts/cmTest.cpp25
-rw-r--r--test cases/cmake/19 advanced options/subprojects/cmOpts/cmTest.hpp3
-rw-r--r--test cases/cmake/19 advanced options/subprojects/cmOpts/main.cpp10
6 files changed, 101 insertions, 0 deletions
diff --git a/test cases/cmake/19 advanced options/subprojects/cmOpts/CMakeLists.txt b/test cases/cmake/19 advanced options/subprojects/cmOpts/CMakeLists.txt
new file mode 100644
index 0000000..584841e
--- /dev/null
+++ b/test cases/cmake/19 advanced options/subprojects/cmOpts/CMakeLists.txt
@@ -0,0 +1,18 @@
+cmake_minimum_required(VERSION 3.7)
+
+project(CmOpts)
+
+set(CMAKE_CXX_STANDARD 98)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+if(NOT "${SOME_CMAKE_VAR}" STREQUAL "something")
+ message(FATAL_ERROR "Setting the CMake var failed")
+endif()
+
+add_library(cmModLib++ STATIC cmMod.cpp)
+add_library(cmTestLib STATIC cmTest.cpp)
+add_executable(testEXE main.cpp)
+
+target_link_libraries(testEXE cmModLib++)
+
+install(TARGETS cmTestLib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin)
diff --git a/test cases/cmake/19 advanced options/subprojects/cmOpts/cmMod.cpp b/test cases/cmake/19 advanced options/subprojects/cmOpts/cmMod.cpp
new file mode 100644
index 0000000..7651b60
--- /dev/null
+++ b/test cases/cmake/19 advanced options/subprojects/cmOpts/cmMod.cpp
@@ -0,0 +1,31 @@
+#include "cmMod.hpp"
+
+using namespace std;
+
+#if __cplusplus < 201402L
+#error "At least C++14 is required"
+#endif
+
+#ifndef MESON_GLOBAL_FLAG
+#error "MESON_GLOBAL_FLAG was not set"
+#endif
+
+#ifndef MESON_SPECIAL_FLAG1
+#error "MESON_SPECIAL_FLAG1 was not set"
+#endif
+
+#ifndef MESON_SPECIAL_FLAG2
+#error "MESON_SPECIAL_FLAG2 was not set"
+#endif
+
+cmModClass::cmModClass(string foo) {
+ str = foo + " World";
+}
+
+string cmModClass::getStr() const {
+ return str;
+}
+
+int cmModClass::getInt() const {
+ return MESON_MAGIC_INT;
+}
diff --git a/test cases/cmake/19 advanced options/subprojects/cmOpts/cmMod.hpp b/test cases/cmake/19 advanced options/subprojects/cmOpts/cmMod.hpp
new file mode 100644
index 0000000..0748936
--- /dev/null
+++ b/test cases/cmake/19 advanced options/subprojects/cmOpts/cmMod.hpp
@@ -0,0 +1,14 @@
+#pragma once
+
+#include <string>
+
+class cmModClass {
+private:
+ std::string str;
+
+public:
+ cmModClass(std::string foo);
+
+ std::string getStr() const;
+ int getInt() const;
+};
diff --git a/test cases/cmake/19 advanced options/subprojects/cmOpts/cmTest.cpp b/test cases/cmake/19 advanced options/subprojects/cmOpts/cmTest.cpp
new file mode 100644
index 0000000..a00cdcd
--- /dev/null
+++ b/test cases/cmake/19 advanced options/subprojects/cmOpts/cmTest.cpp
@@ -0,0 +1,25 @@
+#include "cmTest.hpp"
+
+#if __cplusplus < 201103L
+#error "At least C++11 is required"
+#endif
+
+#if __cplusplus >= 201402L
+#error "At most C++11 is required"
+#endif
+
+#ifndef MESON_GLOBAL_FLAG
+#error "MESON_GLOBAL_FLAG was not set"
+#endif
+
+#ifdef MESON_SPECIAL_FLAG1
+#error "MESON_SPECIAL_FLAG1 *was* set"
+#endif
+
+#ifdef MESON_SPECIAL_FLAG2
+#error "MESON_SPECIAL_FLAG2 *was* set"
+#endif
+
+int getTestInt() {
+ return MESON_MAGIC_INT;
+}
diff --git a/test cases/cmake/19 advanced options/subprojects/cmOpts/cmTest.hpp b/test cases/cmake/19 advanced options/subprojects/cmOpts/cmTest.hpp
new file mode 100644
index 0000000..5a3bf7b
--- /dev/null
+++ b/test cases/cmake/19 advanced options/subprojects/cmOpts/cmTest.hpp
@@ -0,0 +1,3 @@
+#pragma once
+
+int getTestInt();
diff --git a/test cases/cmake/19 advanced options/subprojects/cmOpts/main.cpp b/test cases/cmake/19 advanced options/subprojects/cmOpts/main.cpp
new file mode 100644
index 0000000..497d1ce
--- /dev/null
+++ b/test cases/cmake/19 advanced options/subprojects/cmOpts/main.cpp
@@ -0,0 +1,10 @@
+#include <iostream>
+#include "cmMod.hpp"
+
+using namespace std;
+
+int main(void) {
+ cmModClass obj("Hello (LIB TEST)");
+ cout << obj.getStr() << endl;
+ return 0;
+}