diff --git a/CMakeLists.txt b/CMakeLists.txt index aaed6de14..afc3236ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,8 @@ project(wwiv) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) +include_directories(${CMAKE_SOURCE_DIR}) + include(Common) include(FindASan) diff --git a/bbs/CMakeLists.txt b/bbs/CMakeLists.txt index ad10a59fe..0807ad79f 100644 --- a/bbs/CMakeLists.txt +++ b/bbs/CMakeLists.txt @@ -1,5 +1,4 @@ # CMake for WWIV -include_directories(..) include_directories(../deps/cl342) include_directories(../deps/cereal/include) Include(FindWWIVCurses) diff --git a/bbs_test/CMakeLists.txt b/bbs_test/CMakeLists.txt index 8cad234c9..d53daa0c3 100644 --- a/bbs_test/CMakeLists.txt +++ b/bbs_test/CMakeLists.txt @@ -1,6 +1,5 @@ -include_directories(../deps/googletest/googletest/include) -include_directories(..) +include_directories(${GTEST_INCLUDE_DIRS}) include_directories(../deps/cereal/include) set(test_sources diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index d800150c9..6e827309b 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -1,5 +1,4 @@ # CMake for WWIV -include_directories(..) set(COMMON_SOURCES clock.cpp diff --git a/core_test/CMakeLists.txt b/core_test/CMakeLists.txt index 8d5a2edd1..8bc41a680 100644 --- a/core_test/CMakeLists.txt +++ b/core_test/CMakeLists.txt @@ -1,5 +1,4 @@ -include_directories(../deps/googletest/googletest/include) -include_directories(..) +include_directories(${GTEST_INCLUDE_DIRS}) set(fixture_sources file_helper.cpp diff --git a/core_test/clock_test.cpp b/core_test/clock_test.cpp index 864247618..71768eda9 100644 --- a/core_test/clock_test.cpp +++ b/core_test/clock_test.cpp @@ -28,13 +28,13 @@ using std::vector; using namespace wwiv::core; -TEST(Clock, Simple) { - auto start = DateTime::now(); +TEST(Clock, Simple) { + const auto start = DateTime::now(); SystemClock c{}; - auto mid = c.Now(); + const auto mid = c.Now(); - auto end = DateTime::now(); + const auto end = DateTime::now(); EXPECT_GE(mid, start); EXPECT_LE(mid, end); diff --git a/core_test/file_helper.h b/core_test/file_helper.h index 4b0ccdc03..404dc327f 100644 --- a/core_test/file_helper.h +++ b/core_test/file_helper.h @@ -25,7 +25,7 @@ #include /** - * Helper class for tests requing local filesystem access. + * Helper class for tests requiring local filesystem access. * * Note: This class can not use File since it is used by the tests for File. */ @@ -35,17 +35,17 @@ class FileHelper { // Returns a fully qualified path name to "name" under the temporary directory. // This will end with a pathSeparator and is suitable for use // in wwiv datastructures. - const std::string DirName(const std::string& name) const; + [[nodiscard]] const std::string DirName(const std::string& name) const; // Returns a fully qualified path to "name" under the temporary directory. // This is suitable for use in constructing paths - const std::filesystem::path Dir(const std::string& name) const; + [[nodiscard]] const std::filesystem::path Dir(const std::string& name) const; // Creates a directory under TempDir. bool Mkdir(const std::string& name) const; std::filesystem::path CreateTempFilePath(const std::string& name); std::tuple OpenTempFile(const std::string& name); std::filesystem::path CreateTempFile(const std::string& name, const std::string& contents); - const std::filesystem::path& TempDir() const { return tmp_; } - const std::string ReadFile(const std::filesystem::path& name) const; + [[nodiscard]] const std::filesystem::path& TempDir() const { return tmp_; } + [[nodiscard]] const std::string ReadFile(const std::filesystem::path& name) const; static void set_wwiv_test_tempdir(const std::string& d) noexcept; private: diff --git a/core_test/log_test.cpp b/core_test/log_test.cpp index f1649d25f..c896d7d3f 100644 --- a/core_test/log_test.cpp +++ b/core_test/log_test.cpp @@ -20,7 +20,6 @@ #include "core/log.h" #include -#include #include #include @@ -33,7 +32,7 @@ using namespace wwiv::core; class TestAppender : public Appender { public: TestAppender() : Appender() {} - virtual bool append(const std::string& message) const { + bool append(const std::string& message) override { log_lines.push_back(message); return true; } @@ -43,7 +42,7 @@ class TestAppender : public Appender { class LogTest : public ::testing::Test { protected: - virtual void SetUp() { + void SetUp() override { // Clear all of the loggers info = std::make_shared(); warning = std::make_shared(); @@ -52,11 +51,11 @@ class LogTest : public ::testing::Test { Logger::config().add_appender(LoggerLevel::warning, warning); timestamp.assign("2018-01-01 21:12:00,530 "); - timestamp_fn fn = [this]() { return timestamp; }; + const auto fn = [this]() { return timestamp; }; Logger::config().timestamp_fn_ = fn; } - virtual void TearDown() { Logger::config().reset(); } + void TearDown() override { Logger::config().reset(); } std::shared_ptr info; std::shared_ptr warning; diff --git a/local_io/CMakeLists.txt b/local_io/CMakeLists.txt index a66f98d0c..b884f187e 100644 --- a/local_io/CMakeLists.txt +++ b/local_io/CMakeLists.txt @@ -1,5 +1,4 @@ # CMake for WWIV -include_directories(..) Include(FindWWIVCurses) set(COMMON_SOURCES diff --git a/localui/CMakeLists.txt b/localui/CMakeLists.txt index fc0c29ce5..b48a75291 100644 --- a/localui/CMakeLists.txt +++ b/localui/CMakeLists.txt @@ -1,5 +1,4 @@ # CMake for WWIV 5 -include_directories(..) Include(FindWWIVCurses) set(COMMON_SOURCES diff --git a/net_core/CMakeLists.txt b/net_core/CMakeLists.txt index caffdabe8..725ed3d58 100644 --- a/net_core/CMakeLists.txt +++ b/net_core/CMakeLists.txt @@ -1,5 +1,4 @@ # CMake for WWIV 5 -include_directories(..) set(SOURCES net_cmdline.cpp diff --git a/net_core_test/CMakeLists.txt b/net_core_test/CMakeLists.txt index 558bbf797..002c8dafd 100644 --- a/net_core_test/CMakeLists.txt +++ b/net_core_test/CMakeLists.txt @@ -1,7 +1,6 @@ enable_testing() -include_directories(../deps/googletest/googletest/include) -include_directories(..) +include_directories(${GTEST_INCLUDE_DIRS}) set(test_sources net_cmdline_test.cpp diff --git a/network/CMakeLists.txt b/network/CMakeLists.txt index db7e3ba67..e396910a3 100644 --- a/network/CMakeLists.txt +++ b/network/CMakeLists.txt @@ -1,5 +1,4 @@ # CMake for WWIV 5 -include_directories(..) set(NETWORK_MAIN network.cpp) diff --git a/network1/CMakeLists.txt b/network1/CMakeLists.txt index 1523175c6..545e07fec 100644 --- a/network1/CMakeLists.txt +++ b/network1/CMakeLists.txt @@ -1,5 +1,4 @@ # CMake for WWIV 5 -include_directories(..) set(NETWORK_MAIN network1.cpp) diff --git a/network2/CMakeLists.txt b/network2/CMakeLists.txt index bdd65dec5..bb7482aa5 100644 --- a/network2/CMakeLists.txt +++ b/network2/CMakeLists.txt @@ -1,5 +1,4 @@ # CMake for WWIV 5 -include_directories(..) set(NETWORK_MAIN network2.cpp diff --git a/network3/CMakeLists.txt b/network3/CMakeLists.txt index db788aac3..e97321073 100644 --- a/network3/CMakeLists.txt +++ b/network3/CMakeLists.txt @@ -1,5 +1,4 @@ # CMake for WWIV 5 -include_directories(..) set(NETWORK_MAIN network3.cpp) diff --git a/networkb/CMakeLists.txt b/networkb/CMakeLists.txt index 46cd2c4df..77f428b90 100644 --- a/networkb/CMakeLists.txt +++ b/networkb/CMakeLists.txt @@ -1,5 +1,4 @@ # CMake for WWIV 5 -include_directories(..) set(NETWORKB_MAIN networkb.cpp) diff --git a/networkb_test/CMakeLists.txt b/networkb_test/CMakeLists.txt index 926c3f356..265383103 100644 --- a/networkb_test/CMakeLists.txt +++ b/networkb_test/CMakeLists.txt @@ -1,7 +1,6 @@ enable_testing() -include_directories(../deps/googletest/googletest/include) -include_directories(..) +include_directories(${GTEST_INCLUDE_DIRS}) set(test_sources binkp_test.cpp diff --git a/networkc/CMakeLists.txt b/networkc/CMakeLists.txt index 0bf03f7e0..aa79e13f0 100644 --- a/networkc/CMakeLists.txt +++ b/networkc/CMakeLists.txt @@ -1,5 +1,4 @@ # CMake for WWIV 5 -include_directories(..) set(NETWORK_MAIN networkc.cpp) diff --git a/networkf/CMakeLists.txt b/networkf/CMakeLists.txt index 512f7b403..16ca3fab1 100644 --- a/networkf/CMakeLists.txt +++ b/networkf/CMakeLists.txt @@ -1,5 +1,4 @@ # CMake for WWIV 5 -include_directories(..) set(NETWORK_MAIN networkf.cpp) diff --git a/sdk/CMakeLists.txt b/sdk/CMakeLists.txt index 23c62989f..a538ebf6d 100644 --- a/sdk/CMakeLists.txt +++ b/sdk/CMakeLists.txt @@ -1,4 +1,3 @@ -include_directories(..) include_directories(../deps/cereal/include) set(COMMON_SOURCES diff --git a/sdk_test/CMakeLists.txt b/sdk_test/CMakeLists.txt index 62ee448d2..c38ab0b5c 100644 --- a/sdk_test/CMakeLists.txt +++ b/sdk_test/CMakeLists.txt @@ -1,5 +1,4 @@ -include_directories(../deps/googletest/googletest/include) -include_directories(..) +include_directories(${GTEST_INCLUDE_DIRS}) set(test_sources callout_test.cpp diff --git a/wwivconfig/CMakeLists.txt b/wwivconfig/CMakeLists.txt index d3fdf04fc..e5b9a607d 100644 --- a/wwivconfig/CMakeLists.txt +++ b/wwivconfig/CMakeLists.txt @@ -1,5 +1,4 @@ # CMake for WWIV 5 -include_directories(..) Include(FindWWIVCurses) diff --git a/wwivd/CMakeLists.txt b/wwivd/CMakeLists.txt index 4060ed741..2a0ccd523 100644 --- a/wwivd/CMakeLists.txt +++ b/wwivd/CMakeLists.txt @@ -1,5 +1,4 @@ # CMake for WWIV Daemon -include_directories(..) include_directories(../deps/cereal/include) set(WWIVD_SOURCES diff --git a/wwivd_test/CMakeLists.txt b/wwivd_test/CMakeLists.txt index f428cbf00..3aafb7452 100644 --- a/wwivd_test/CMakeLists.txt +++ b/wwivd_test/CMakeLists.txt @@ -1,6 +1,4 @@ -include_directories(../deps/googletest/googletest/include) -include_directories(..) - +include_directories(${GTEST_INCLUDE_DIRS}) set(test_sources wwivd_non_http_test.cpp diff --git a/wwivutil/CMakeLists.txt b/wwivutil/CMakeLists.txt index a5e1f0564..09be9af25 100644 --- a/wwivutil/CMakeLists.txt +++ b/wwivutil/CMakeLists.txt @@ -1,5 +1,4 @@ # CMake for WWIV 5 -include_directories(..) set(WWIVUTIL_MAIN wwivutil.cpp)