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)