build: build with BOOST_FILESYSTEM_NO_DEPRECATED

Change-Id: I8d49dc03bd052c04c00b71f7ccf02cab79e64b7c
diff --git a/ndn-cxx/security/pib/impl/pib-sqlite3.cpp b/ndn-cxx/security/pib/impl/pib-sqlite3.cpp
index d32c7aa..0e42c52 100644
--- a/ndn-cxx/security/pib/impl/pib-sqlite3.cpp
+++ b/ndn-cxx/security/pib/impl/pib-sqlite3.cpp
@@ -26,7 +26,8 @@
 
 #include <sqlite3.h>
 
-#include <boost/filesystem.hpp>
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
 
 namespace ndn {
 namespace security {
diff --git a/ndn-cxx/security/tpm/impl/back-end-file.cpp b/ndn-cxx/security/tpm/impl/back-end-file.cpp
index 58e9aaf..f31a139 100644
--- a/ndn-cxx/security/tpm/impl/back-end-file.cpp
+++ b/ndn-cxx/security/tpm/impl/back-end-file.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2019 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -29,7 +29,11 @@
 #include <fstream>
 #include <sys/stat.h>
 
-#include <boost/filesystem.hpp>
+#if BOOST_VERSION >= 107200
+#include <boost/filesystem/exception.hpp>
+#endif
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
 #include <boost/lexical_cast.hpp>
 
 namespace ndn {
diff --git a/ndn-cxx/security/trust-anchor-container.cpp b/ndn-cxx/security/trust-anchor-container.cpp
index cc5e168..ccd123a 100644
--- a/ndn-cxx/security/trust-anchor-container.cpp
+++ b/ndn-cxx/security/trust-anchor-container.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -21,8 +21,6 @@
 
 #include "ndn-cxx/security/trust-anchor-container.hpp"
 
-#include <boost/filesystem.hpp>
-
 namespace ndn {
 namespace security {
 inline namespace v2 {
diff --git a/ndn-cxx/security/trust-anchor-group.cpp b/ndn-cxx/security/trust-anchor-group.cpp
index 2b1a25e..565c760 100644
--- a/ndn-cxx/security/trust-anchor-group.cpp
+++ b/ndn-cxx/security/trust-anchor-group.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -23,7 +23,10 @@
 #include "ndn-cxx/util/io.hpp"
 #include "ndn-cxx/util/logger.hpp"
 
-#include <boost/filesystem.hpp>
+#if BOOST_VERSION >= 107200
+#include <boost/filesystem/directory.hpp>
+#endif
+#include <boost/filesystem/operations.hpp>
 #include <boost/range/adaptor/map.hpp>
 #include <boost/range/algorithm/copy.hpp>
 #include <boost/range/iterator_range.hpp>
@@ -127,10 +130,8 @@
   if (!m_isDir) {
     loadCert(m_path);
   }
-  else {
-    if (fs::exists(m_path)) {
-      std::for_each(fs::directory_iterator(m_path), fs::directory_iterator(), loadCert);
-    }
+  else if (fs::exists(m_path)) {
+    std::for_each(fs::directory_iterator(m_path), fs::directory_iterator(), loadCert);
   }
 
   // remove old certs
diff --git a/ndn-cxx/security/validation-policy-config.cpp b/ndn-cxx/security/validation-policy-config.cpp
index c5fdfbc..4cf0f44 100644
--- a/ndn-cxx/security/validation-policy-config.cpp
+++ b/ndn-cxx/security/validation-policy-config.cpp
@@ -24,7 +24,8 @@
 #include "ndn-cxx/util/io.hpp"
 
 #include <boost/algorithm/string/predicate.hpp>
-#include <boost/filesystem.hpp>
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
 #include <boost/lexical_cast.hpp>
 #include <boost/property_tree/info_parser.hpp>
 
diff --git a/ndn-cxx/util/config-file.cpp b/ndn-cxx/util/config-file.cpp
index f08d3eb..14d852b 100644
--- a/ndn-cxx/util/config-file.cpp
+++ b/ndn-cxx/util/config-file.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2019 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -21,8 +21,8 @@
 
 #include "ndn-cxx/util/config-file.hpp"
 
+#include <boost/filesystem/operations.hpp>
 #include <boost/property_tree/ini_parser.hpp>
-#include <boost/filesystem.hpp>
 
 namespace ndn {
 
diff --git a/ndn-cxx/util/config-file.hpp b/ndn-cxx/util/config-file.hpp
index bdcb374..00750dd 100644
--- a/ndn-cxx/util/config-file.hpp
+++ b/ndn-cxx/util/config-file.hpp
@@ -26,7 +26,7 @@
 
 #include <fstream>
 
-#include <boost/filesystem.hpp>
+#include <boost/filesystem/path.hpp>
 #include <boost/property_tree/ptree.hpp>
 
 namespace ndn {
@@ -54,7 +54,7 @@
     using std::runtime_error::runtime_error;
   };
 
-  typedef boost::property_tree::ptree Parsed;
+  using Parsed = boost::property_tree::ptree;
 
   /**
    * @brief Locate, open, and parse a library configuration file.
diff --git a/tests/key-chain-fixture.cpp b/tests/key-chain-fixture.cpp
index e2d7a97..92518a3 100644
--- a/tests/key-chain-fixture.cpp
+++ b/tests/key-chain-fixture.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -23,7 +23,7 @@
 
 #include "ndn-cxx/util/io.hpp"
 
-#include <boost/filesystem.hpp>
+#include <boost/filesystem/operations.hpp>
 
 namespace ndn {
 namespace tests {
diff --git a/tests/test-home-fixture.hpp b/tests/test-home-fixture.hpp
index af5e839..3d4f056 100644
--- a/tests/test-home-fixture.hpp
+++ b/tests/test-home-fixture.hpp
@@ -29,7 +29,8 @@
 #include <initializer_list>
 
 #include <boost/algorithm/string/replace.hpp>
-#include <boost/filesystem.hpp>
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
 
 namespace ndn {
 namespace tests {
diff --git a/tests/unit/security/trust-anchor-container.t.cpp b/tests/unit/security/trust-anchor-container.t.cpp
index 17151c8..bb336b5 100644
--- a/tests/unit/security/trust-anchor-container.t.cpp
+++ b/tests/unit/security/trust-anchor-container.t.cpp
@@ -26,7 +26,7 @@
 #include "tests/key-chain-fixture.hpp"
 #include "tests/unit/clock-fixture.hpp"
 
-#include <boost/filesystem.hpp>
+#include <boost/filesystem/operations.hpp>
 
 namespace ndn {
 namespace security {
diff --git a/tests/unit/util/config-file.t.cpp b/tests/unit/util/config-file.t.cpp
index 78b80be..9e098c1 100644
--- a/tests/unit/util/config-file.t.cpp
+++ b/tests/unit/util/config-file.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -24,6 +24,7 @@
 #include "tests/boost-test.hpp"
 #include "tests/unit/test-home-env-saver.hpp"
 
+#include <boost/filesystem/operations.hpp>
 #include <cstdlib>
 
 namespace ndn {
diff --git a/wscript b/wscript
index 6b2d350..c28bed1 100644
--- a/wscript
+++ b/wscript
@@ -140,6 +140,8 @@
     if conf.env.BOOST_VERSION_NUMBER < 106900 and conf.env.CXX_NAME == 'clang':
         conf.env.append_unique('DEFINES_BOOST', ['BOOST_ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW'])
 
+    conf.env.append_unique('DEFINES_BOOST', ['BOOST_FILESYSTEM_NO_DEPRECATED'])
+
     conf.check_compiler_flags()
 
     # Loading "late" to prevent tests from being compiled with profiling flags