examples: add library usage examples

refs: #4793

Change-Id: I660ed74bca55debd885b4cdefb230225ccdfe4ca
diff --git a/wscript b/wscript
index 447f6b5..04445f3 100644
--- a/wscript
+++ b/wscript
@@ -13,8 +13,11 @@
               'sanitizers', 'coverage', 'pch'],
              tooldir=['.waf-tools'])
 
-    opt.add_option('--with-tests', action='store_true', default=False, dest='with_tests',
-                   help='''build unit tests''')
+    opt.add_option('--with-examples', action='store_true', default=False,
+                   help='Build examples')
+
+    opt.add_option('--with-tests', action='store_true', default=False,
+                   help='Build unit tests')
 
 def configure(conf):
     conf.load(['compiler_c', 'compiler_cxx', 'gnu_dirs', 'default-compiler-flags',
@@ -26,9 +29,11 @@
     conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'],
                    uselib_store='NDN_CXX', mandatory=True)
 
+    conf.env['WITH_TESTS'] = conf.options.with_tests
+    conf.env['WITH_EXAMPLES'] = conf.options.with_examples
+
     boost_libs = 'system thread log log_setup'
-    if conf.options.with_tests:
-        conf.env['WITH_TESTS'] = 1
+    if conf.env['WITH_TESTS']:
         conf.define('WITH_TESTS', 1);
         boost_libs += ' unit_test_framework'
 
@@ -76,6 +81,9 @@
     if bld.env['WITH_TESTS']:
         bld.recurse('tests')
 
+    if bld.env['WITH_EXAMPLES']:
+        bld.recurse('examples')
+
 def docs(bld):
     from waflib import Options
     Options.commands = ['doxygen', 'sphinx'] + Options.commands