aboutsummaryrefslogtreecommitdiff
path: root/demo/http_client
diff options
context:
space:
mode:
Diffstat (limited to 'demo/http_client')
-rw-r--r--demo/http_client/CMakeLists.txt18
-rw-r--r--demo/http_client/README.adoc12
-rw-r--r--demo/http_client/http_client.c1
3 files changed, 30 insertions, 1 deletions
diff --git a/demo/http_client/CMakeLists.txt b/demo/http_client/CMakeLists.txt
new file mode 100644
index 00000000..3fe126f9
--- /dev/null
+++ b/demo/http_client/CMakeLists.txt
@@ -0,0 +1,18 @@
+#
+# Copyright 2018 Capitar IT Group BV <info@capitar.com>
+# Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+#
+# This software is supplied under the terms of the MIT License, a
+# copy of which should be located in the distribution where this
+# file was obtained (LICENSE.txt). A copy of the license may also be
+# found online at https://opensource.org/licenses/MIT.
+
+cmake_minimum_required (VERSION 2.8.7)
+
+project(http_client)
+
+# Call this from your own project's makefile.
+find_package(nng CONFIG REQUIRED)
+
+add_executable(http_client http_client.c)
+target_link_libraries(http_client nng::nng)
diff --git a/demo/http_client/README.adoc b/demo/http_client/README.adoc
index a0fb54e4..f8777557 100644
--- a/demo/http_client/README.adoc
+++ b/demo/http_client/README.adoc
@@ -30,6 +30,17 @@ Linux and macOS:
% ${CC} ${CPPFLAGS} http_client.c -o http_client ${LDFLAGS}
----
+Alternatively, CMake can be used. Here's an example if you have
+Ninja build handy (highly recommended):
+
+[source, bash]
+----
+% mkdir build
+% cd build
+% cmake -G Ninja ..
+% ninja
+----
+
== Running
Make sure you specify the full URL (if the root page include
@@ -39,4 +50,3 @@ the simple "/". The URL parser does not add it for you automatically.)
----
% ./http_client http://httpbin.org/ip
----
-
diff --git a/demo/http_client/http_client.c b/demo/http_client/http_client.c
index 522c1cd1..a00c842f 100644
--- a/demo/http_client/http_client.c
+++ b/demo/http_client/http_client.c
@@ -34,6 +34,7 @@
//
#include <nng/nng.h>
+#include <nng/supplemental/http/http.h>
#include <stdio.h>
#include <stdlib.h>