From 0db6bf5381cdd67d6531e1580ecc1a9bbb28d524 Mon Sep 17 00:00:00 2001 From: Matt <125427297+ConstrictM@users.noreply.github.com> Date: Wed, 16 Sep 2026 18:37:18 -0400 Subject: [PATCH] support headers only installation for utf8cpp FreeBSD and OpenBSD package managers do not build utf8cpp, honoring the upstream installation instructions, so the use of find package fails as these distributions do not ship the cmake files. To fix these distros use find_path to find the include dir. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=298368 (cherry picked from commit 1f64c9a1581875cb59571c6e1bd62544dfdc3fd3) Signed-off-by: Steve Lhomme --- CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f2c9a421..8760026a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,6 +48,11 @@ endfunction() find_package(utf8cpp) if(NOT utf8cpp_FOUND) + # a headers-only utf8cpp installation ships no CMake package + find_path(LIBEBML_UTF8CPP_INCLUDE_DIR utf8/checked.h PATH_SUFFIXES utf8cpp) + mark_as_advanced(LIBEBML_UTF8CPP_INCLUDE_DIR) +endif() +if(NOT utf8cpp_FOUND AND NOT LIBEBML_UTF8CPP_INCLUDE_DIR) include(FetchContent REQUIRED) FetchContent_Declare( utf8cpp @@ -160,7 +165,11 @@ if(MSVC) target_compile_definitions(ebml PRIVATE _CRT_SECURE_NO_WARNINGS) endif() -target_link_libraries(ebml PRIVATE ${libebml_utf8cpp_link_libraries}) +if(LIBEBML_UTF8CPP_INCLUDE_DIR) + target_include_directories(ebml PRIVATE ${LIBEBML_UTF8CPP_INCLUDE_DIR}) +else() + target_link_libraries(ebml PRIVATE ${libebml_utf8cpp_link_libraries}) +endif() include(GenerateExportHeader) generate_export_header(ebml EXPORT_MACRO_NAME EBML_DLL_API)