From bbd7c7a5d6bfb12df3898c4589753b59ce674576 Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Thu, 6 Jan 2022 19:03:19 +0100 Subject: Add header only library, adjust include statements and rename test target --- CMakeLists.txt | 15 ++++++++++++--- cxxformat/core.hpp | 2 +- cxxformat/cxxformat | 7 +++++++ cxxformat/cxxformat.hpp | 7 ------- cxxformat/file_ptr.hpp | 2 +- cxxformat/formatters.hpp | 2 +- cxxformat/ostream.hpp | 2 +- cxxformat/string.hpp | 4 ++-- main.cpp | 2 +- 9 files changed, 26 insertions(+), 17 deletions(-) create mode 100644 cxxformat/cxxformat delete mode 100644 cxxformat/cxxformat.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 49b8ecc..bd2f310 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,16 @@ set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) project(cxxformat) +add_library(cxxformat INTERFACE + cxxformat/cxxformat + cxxformat/core.hpp + cxxformat/file_ptr.hpp + cxxformat/formatters.hpp + cxxformat/helpers.hpp + cxxformat/ostream.hpp + cxxformat/string.hpp +) +target_include_directories(cxxformat INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) -add_executable(cxxformat main.cpp) - -install(TARGETS cxxformat RUNTIME DESTINATION bin) +add_executable(test EXCLUDE_FROM_ALL main.cpp) +target_link_libraries(test PRIVATE cxxformat) diff --git a/cxxformat/core.hpp b/cxxformat/core.hpp index 92ab3c1..8669f1c 100644 --- a/cxxformat/core.hpp +++ b/cxxformat/core.hpp @@ -4,7 +4,7 @@ #include #include -#include "helpers.hpp" +#include namespace format { namespace { diff --git a/cxxformat/cxxformat b/cxxformat/cxxformat new file mode 100644 index 0000000..6da253a --- /dev/null +++ b/cxxformat/cxxformat @@ -0,0 +1,7 @@ +#pragma once + +#include +#include +#include +#include +#include diff --git a/cxxformat/cxxformat.hpp b/cxxformat/cxxformat.hpp deleted file mode 100644 index 3e6fe21..0000000 --- a/cxxformat/cxxformat.hpp +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#include "core.hpp" -#include "formatters.hpp" -#include "file_ptr.hpp" -#include "ostream.hpp" -#include "string.hpp" diff --git a/cxxformat/file_ptr.hpp b/cxxformat/file_ptr.hpp index 53c8a9a..da516b0 100644 --- a/cxxformat/file_ptr.hpp +++ b/cxxformat/file_ptr.hpp @@ -1,6 +1,6 @@ #pragma once -#include "core.hpp" +#include #include diff --git a/cxxformat/formatters.hpp b/cxxformat/formatters.hpp index 94a0ae6..a5c92ed 100644 --- a/cxxformat/formatters.hpp +++ b/cxxformat/formatters.hpp @@ -1,6 +1,6 @@ #pragma once -#include "core.hpp" +#include #include #include diff --git a/cxxformat/ostream.hpp b/cxxformat/ostream.hpp index 830da52..308b670 100644 --- a/cxxformat/ostream.hpp +++ b/cxxformat/ostream.hpp @@ -1,6 +1,6 @@ #pragma once -#include "core.hpp" +#include #include diff --git a/cxxformat/string.hpp b/cxxformat/string.hpp index c0fa565..06cb620 100644 --- a/cxxformat/string.hpp +++ b/cxxformat/string.hpp @@ -1,7 +1,7 @@ #pragma once -#include "core.hpp" -#include "ostream.hpp" +#include +#include #include diff --git a/main.cpp b/main.cpp index b858b85..f448ed7 100644 --- a/main.cpp +++ b/main.cpp @@ -1,7 +1,7 @@ #include #include -#include "cxxformat/cxxformat.hpp" +#include void numberTests() { -- cgit v1.2.3-54-g00ecf