CMake config file: Support both expat versions. Require C++14 support
Fix
MODIFY
CMakeLists.txt
CMakeLists.txt
@@ -348,8 +348,14 @@ endif()
# expat
if(NOT DISABLE_XML)
- find_package(EXPAT)
+ find_package(expat)
+ if(expat_FOUND)
+ target_link_libraries(lcf expat::expat)
+ else()
+ # Fallback to old expat detection
+ find_package(EXPAT REQUIRED)
target_link_libraries(lcf EXPAT::EXPAT)
+ endif()
list(APPEND LIBLCF_DEPS "expat")
set(LCF_SUPPORT_XML "1")
endif()

MODIFY
builds/liblcf-config.cmake.in
builds/liblcf-config.cmake.in
@@ -80,10 +80,16 @@ if(LIBLCF_FOUND)
list(APPEND LIBLCF_LIBRARIES ${ICU_LIBRARIES})
list(APPEND LIBLCF_LINK_LIBRARIES ICU::i18n ICU::uc ICU::data)
elseif(dep STREQUAL "expat")
+ find_package(expat QUIET)
+ if(expat_FOUND)
+ list(APPEND LIBLCF_LINK_LIBRARIES expat::expat)
+ else()
+ # Fallback to old expat detection
find_package(EXPAT REQUIRED QUIET)
- list(APPEND LIBLCF_LIBRARIES ${EXPAT_LIBRARIES})
list(APPEND LIBLCF_LINK_LIBRARIES EXPAT::EXPAT)
endif()
+ list(APPEND LIBLCF_LIBRARIES ${EXPAT_LIBRARIES})
+ endif()
endforeach()
set_target_properties(liblcf::liblcf PROPERTIES
@@ -110,6 +116,10 @@ if(LIBLCF_FOUND)
IMPORTED_LOCATION "${LIBLCF_LIBRARY}")
endif()
+ if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.8")
+ target_compile_features(liblcf::liblcf PUBLIC cxx_std_14)
+ endif()
+
mark_as_advanced(LIBLCF_LIBRARY_DEPS LIBLCF_LINK_LIBRARIES)
endif()
endif()

CMake config file: Support both expat versions. Require C++14 support

Fix #385