From 1a95c1d4824bb6f97cd5a63039bd531cb2b315de Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Sat, 15 Oct 2022 14:12:52 +0200 Subject: [PATCH] use the utf-8 C++ library as an external (header-only) library It might be used as an external package someday. For it's a CMake interface since it's a header only piece of code. --- CMakeLists.txt | 3 +++ src/EbmlUnicodeString.cpp | 2 +- src/lib/utf8-cpp/CMakeLists.txt | 10 ++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 src/lib/utf8-cpp/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index cfdb788b..18995c4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,6 +95,9 @@ if(MSVC) target_compile_definitions(ebml PRIVATE _CRT_SECURE_NO_WARNINGS) endif() +add_subdirectory(src/lib/utf8-cpp) +target_link_libraries(ebml PRIVATE $) + include(GenerateExportHeader) generate_export_header(ebml EXPORT_MACRO_NAME EBML_DLL_API) target_sources(ebml diff --git a/src/EbmlUnicodeString.cpp b/src/EbmlUnicodeString.cpp index 5aef8b5c..8678a92f 100644 --- a/src/EbmlUnicodeString.cpp +++ b/src/EbmlUnicodeString.cpp @@ -40,7 +40,7 @@ #include "ebml/EbmlUnicodeString.h" -#include "lib/utf8-cpp/source/utf8/checked.h" +#include namespace libebml { diff --git a/src/lib/utf8-cpp/CMakeLists.txt b/src/lib/utf8-cpp/CMakeLists.txt new file mode 100644 index 00000000..a850c0ca --- /dev/null +++ b/src/lib/utf8-cpp/CMakeLists.txt @@ -0,0 +1,10 @@ +add_library(utf8-cpp INTERFACE) + +target_include_directories(utf8-cpp INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/source) +target_sources(utf8-cpp INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR}/source/utf8/checked.h + ${CMAKE_CURRENT_SOURCE_DIR}/source/utf8/core.h + ${CMAKE_CURRENT_SOURCE_DIR}/source/utf8/cpp11.h + ${CMAKE_CURRENT_SOURCE_DIR}/source/utf8/cpp17.h + ${CMAKE_CURRENT_SOURCE_DIR}/source/utf8/checked.h +)