diff options
Diffstat (limited to 'meson/test cases/cmake/3 advanced no dep/subprojects')
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; +} |