summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Mittendrein <maxmitti@maxmitti.tk>2022-01-06 19:03:19 +0100
committerMarkus Mittendrein <maxmitti@maxmitti.tk>2022-01-06 19:03:19 +0100
commitbbd7c7a5d6bfb12df3898c4589753b59ce674576 (patch)
treed7f552533851bb0418bc98581264f30c515b5970
parent451ad9aa0f7f44c9cec4143e6f7ddca0ed84bc42 (diff)
downloadcxxformat-bbd7c7a5d6bfb12df3898c4589753b59ce674576.tar.gz
cxxformat-bbd7c7a5d6bfb12df3898c4589753b59ce674576.zip
Add header only library, adjust include statements and rename test target
-rw-r--r--CMakeLists.txt15
-rw-r--r--cxxformat/core.hpp2
-rw-r--r--cxxformat/cxxformat7
-rw-r--r--cxxformat/cxxformat.hpp7
-rw-r--r--cxxformat/file_ptr.hpp2
-rw-r--r--cxxformat/formatters.hpp2
-rw-r--r--cxxformat/ostream.hpp2
-rw-r--r--cxxformat/string.hpp4
-rw-r--r--main.cpp2
9 files changed, 26 insertions, 17 deletions
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 <stdexcept>
#include <string_view>
-#include "helpers.hpp"
+#include <cxxformat/helpers.hpp>
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 <cxxformat/core.hpp>
+#include <cxxformat/formatters.hpp>
+#include <cxxformat/file_ptr.hpp>
+#include <cxxformat/ostream.hpp>
+#include <cxxformat/string.hpp>
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 <cxxformat/core.hpp>
#include <cstdio>
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 <cxxformat/core.hpp>
#include <array>
#include <bit>
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 <cxxformat/core.hpp>
#include <iostream>
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 <cxxformat/core.hpp>
+#include <cxxformat/ostream.hpp>
#include <sstream>
diff --git a/main.cpp b/main.cpp
index b858b85..f448ed7 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,7 +1,7 @@
#include <iostream>
#include <sstream>
-#include "cxxformat/cxxformat.hpp"
+#include <cxxformat/cxxformat>
void numberTests()
{