From 4deaafd9e01bccca8b71c46abd8343c445510f50 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 --- CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e2f620d..665df21b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,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 @@ -143,7 +148,11 @@ if(WIN32) 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() if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.20") if(${CMAKE_CXX_BYTE_ORDER} STREQUAL "BIG_ENDIAN")