build: Enabling ability to use precompiled headers and some other build fixes

Change-Id: If2b216e5674fc762338929026733f3dcb801bb1b
Refs: #1588
diff --git a/tests/boost-test.hpp b/tests/boost-test.hpp
new file mode 100644
index 0000000..a3b8579
--- /dev/null
+++ b/tests/boost-test.hpp
@@ -0,0 +1,37 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014,  Regents of the University of California,
+ *                      Arizona Board of Regents,
+ *                      Colorado State University,
+ *                      University Pierre & Marie Curie, Sorbonne University,
+ *                      Washington University in St. Louis,
+ *                      Beijing Institute of Technology,
+ *                      The University of Memphis
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NFD_TESTS_BOOST_TEST_HPP
+#define NFD_TESTS_BOOST_TEST_HPP
+
+// suppress warnings from Boost.Test
+#pragma GCC system_header
+#pragma clang system_header
+
+#include <boost/test/unit_test.hpp>
+#include <boost/concept_check.hpp>
+#include <boost/test/output_test_stream.hpp>
+
+#endif // NFD_TESTS_BOOST_TEST_HPP
diff --git a/tests/main.cpp b/tests/main.cpp
index 580d72b..2733634 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -25,4 +25,4 @@
 #define BOOST_TEST_MAIN 1
 #define BOOST_TEST_DYN_LINK 1
 
-#include <boost/test/unit_test.hpp>
+#include "boost-test.hpp"
diff --git a/tests/test-common.hpp b/tests/test-common.hpp
index 8939324..15124cd 100644
--- a/tests/test-common.hpp
+++ b/tests/test-common.hpp
@@ -25,9 +25,11 @@
 #ifndef NFD_TESTS_TEST_COMMON_HPP
 #define NFD_TESTS_TEST_COMMON_HPP
 
-#include <boost/test/unit_test.hpp>
+#include "boost-test.hpp"
+
 #include "core/global-io.hpp"
 #include "core/logger.hpp"
+
 #include <ndn-cxx/security/key-chain.hpp>
 
 namespace nfd {
diff --git a/tests/test-pch.hpp b/tests/test-pch.hpp
new file mode 100644
index 0000000..9f89474
--- /dev/null
+++ b/tests/test-pch.hpp
@@ -0,0 +1,32 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014,  Regents of the University of California,
+ *                      Arizona Board of Regents,
+ *                      Colorado State University,
+ *                      University Pierre & Marie Curie, Sorbonne University,
+ *                      Washington University in St. Louis,
+ *                      Beijing Institute of Technology,
+ *                      The University of Memphis
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NFD_TESTS_TEST_PCH_HPP
+#define NFD_TESTS_TEST_PCH_HPP
+
+#include "common.hpp"
+#include "boost-test.hpp"
+
+#endif // NFD_TESTS_TEST_PCH_HPP
diff --git a/tests/wscript b/tests/wscript
index be93c0a..7d8c36d 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -44,6 +44,7 @@
             use='core-objects unit-tests-main',
             includes='.',
             install_path=None,
+            pch='test-pch.hpp',
           )
 
         # NFD tests
@@ -57,6 +58,7 @@
             use='daemon-objects unit-tests-main',
             includes='.',
             install_path=None,
+            pch='test-pch.hpp',
           )
 
         if bld.env['HAVE_LIBPCAP']:
@@ -75,6 +77,7 @@
             use='rib-objects unit-tests-main',
             includes=['.'],
             install_path=None,
+            pch='test-pch.hpp',
           )
 
     # Other tests (e.g., stress tests that can be enabled even if unit tests are disabled)