diff options
Diffstat (limited to 'meson/test cases/cmake/13 system includes')
6 files changed, 82 insertions, 0 deletions
diff --git a/meson/test cases/cmake/13 system includes/main.cpp b/meson/test cases/cmake/13 system includes/main.cpp new file mode 100644 index 000000000..95079615a --- /dev/null +++ b/meson/test cases/cmake/13 system includes/main.cpp @@ -0,0 +1,10 @@ +#include <iostream> +#include <cmMod.hpp> + +using namespace std; + +int main(void) { + cmModClass obj("Hello"); + cout << obj.getStr() << endl; + return 0; +} diff --git a/meson/test cases/cmake/13 system includes/meson.build b/meson/test cases/cmake/13 system includes/meson.build new file mode 100644 index 000000000..d1007da91 --- /dev/null +++ b/meson/test cases/cmake/13 system includes/meson.build @@ -0,0 +1,18 @@ +project( + 'meson_cmake_system_include_bug', ['c', 'cpp'], + default_options: [ + 'warning_level=3', + 'werror=true', + ], +) + +if meson.get_compiler('cpp').get_argument_syntax() == 'msvc' + error('MESON_SKIP_TEST: Skipp with msvc due to missing -system support') +endif + +cm = import('cmake') +sub_pro = cm.subproject('cmMod') +sub_dep = sub_pro.dependency('cmModLib') + +exe1 = executable('main1', ['main.cpp'], dependencies: [sub_dep]) +test('test1', exe1) diff --git a/meson/test cases/cmake/13 system includes/subprojects/cmMod/CMakeLists.txt b/meson/test cases/cmake/13 system includes/subprojects/cmMod/CMakeLists.txt new file mode 100644 index 000000000..a6b0ba40c --- /dev/null +++ b/meson/test cases/cmake/13 system includes/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") + +add_library(cmModLib SHARED cmMod.cpp) +include(GenerateExportHeader) +generate_export_header(cmModLib) + +target_compile_options(cmModLib PRIVATE "-Wall" "-Werror") +target_include_directories(cmModLib SYSTEM PRIVATE "sysInc") diff --git a/meson/test cases/cmake/13 system includes/subprojects/cmMod/cmMod.cpp b/meson/test cases/cmake/13 system includes/subprojects/cmMod/cmMod.cpp new file mode 100644 index 000000000..1eaf0cf31 --- /dev/null +++ b/meson/test cases/cmake/13 system includes/subprojects/cmMod/cmMod.cpp @@ -0,0 +1,12 @@ +#include "cmMod.hpp" +#include "triggerWarn.hpp" + +using namespace std; + +cmModClass::cmModClass(string foo) { + str = foo + " World " + to_string(bar(World)); +} + +string cmModClass::getStr() const { + return str; +} diff --git a/meson/test cases/cmake/13 system includes/subprojects/cmMod/cmMod.hpp b/meson/test cases/cmake/13 system includes/subprojects/cmMod/cmMod.hpp new file mode 100644 index 000000000..52f576bf3 --- /dev/null +++ b/meson/test cases/cmake/13 system includes/subprojects/cmMod/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/13 system includes/subprojects/cmMod/sysInc/triggerWarn.hpp b/meson/test cases/cmake/13 system includes/subprojects/cmMod/sysInc/triggerWarn.hpp new file mode 100644 index 000000000..3b00f2db4 --- /dev/null +++ b/meson/test cases/cmake/13 system includes/subprojects/cmMod/sysInc/triggerWarn.hpp @@ -0,0 +1,14 @@ +#pragma once + +enum Foo { + Hello, + World +}; + +inline int bar( Foo foo ) { + switch(foo) { + case Hello: return 0; + // Warn because of missung case for World + } + return 1; +} |