Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,14 @@ if(LIBLCF_WITH_XML)
find_package(expat CONFIG)
if(expat_FOUND)
target_link_libraries(lcf expat::expat)
set(LCF_SUPPORT_XML 1)
else()
# Fallback to old expat detection
find_package(EXPAT REQUIRED)
target_link_libraries(lcf EXPAT::EXPAT)
set(LCF_SUPPORT_XML 2)
endif()
list(APPEND LIBLCF_DEPS "expat")
set(LCF_SUPPORT_XML 1)
endif()

# mime types
Expand Down
16 changes: 15 additions & 1 deletion builds/cmake/liblcf-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,22 @@ if(@LCF_SUPPORT_ICU@ EQUAL 1)
find_dependency(ICU COMPONENTS i18n uc data REQUIRED)
endif()

if(@LCF_SUPPORT_XML@)
if(@LCF_SUPPORT_XML@ EQUAL 1)
find_dependency(expat CONFIG REQUIRED)
elseif(@LCF_SUPPORT_XML@ EQUAL 2)
# Fallback to old expat detection
find_dependency(EXPAT REQUIRED)
endif()

## Create aliases for common expat target names
# The config file creates expat::expat
if (TARGET expat::expat AND NOT TARGET EXPAT::EXPAT)
add_library(EXPAT::EXPAT ALIAS expat::expat)
endif()

# The find module creates EXPAT::EXPAT
if (TARGET EXPAT::EXPAT AND NOT TARGET expat::expat)
add_library(expat::expat ALIAS EXPAT::EXPAT)
endif()

include(${CMAKE_CURRENT_LIST_DIR}/liblcf-targets.cmake)