From e454564d9a8c80bf57dc37583e7b33b09c4ff6bd Mon Sep 17 00:00:00 2001 From: Artemis Rosman <73006620+rozukke@users.noreply.github.com> Date: Mon, 9 Sep 2024 02:24:42 +1000 Subject: [PATCH] Automatically build examples --- CMakeLists.txt | 8 +++++++- example/hello_minecraft.cpp | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 example/hello_minecraft.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bc6115c..cb4aa800 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,8 +45,14 @@ install(TARGETS ${PROJECT_NAME} PUBLIC_HEADER DESTINATION include/${PROJECT_NAME} ) +# Build examples +add_executable(pyramid example/pyramid.cpp) +target_link_libraries(pyramid ${PROJECT_NAME}) +add_executable(hello_minecraft example/hello_minecraft.cpp) +target_link_libraries(hello_minecraft ${PROJECT_NAME}) + # CPack setup SET(CPACK_GENERATOR "DEB") SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "rozukke") -INCLUDE(CPack) \ No newline at end of file +INCLUDE(CPack) diff --git a/example/hello_minecraft.cpp b/example/hello_minecraft.cpp new file mode 100644 index 00000000..4ea01138 --- /dev/null +++ b/example/hello_minecraft.cpp @@ -0,0 +1,8 @@ +#include + +using namespace mcpp; + +int main() { + MinecraftConnection mc; + mc.postToChat("Hello, Minecraft!"); +}