Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function(add_cxx_flag_if_supported)
endforeach()
endfunction()

find_package(utf8cpp 3.2.0)
find_package(utf8cpp)
if(NOT utf8cpp_FOUND)
include(FetchContent REQUIRED)
FetchContent_Declare(
Expand All @@ -61,6 +61,11 @@ if(NOT utf8cpp_FOUND)
)
FetchContent_MakeAvailable(utf8cpp)
endif()
if(TARGET utf8cpp::utf8cpp)
set(libebml_utf8cpp_link_libraries utf8cpp::utf8cpp)
else()
set(libebml_utf8cpp_link_libraries $<BUILD_INTERFACE:utf8cpp>)
endif()

if(DEV_MODE)
message(STATUS "Using developer mode for ${CMAKE_CXX_COMPILER_ID}")
Expand Down Expand Up @@ -157,7 +162,7 @@ if(MSVC)
target_compile_definitions(ebml PRIVATE _CRT_SECURE_NO_WARNINGS)
endif()

target_link_libraries(ebml PRIVATE $<BUILD_INTERFACE:utf8cpp>)
target_link_libraries(ebml PRIVATE ${libebml_utf8cpp_link_libraries})

include(GenerateExportHeader)
generate_export_header(ebml EXPORT_MACRO_NAME EBML_DLL_API)
Expand Down