Small cmake touch-up:
Set minimal version to 3.10, remove older modules
Support cmake older than 3.12 (no list transform)
Explain missing doxygen (avoid user confusion)
Set all policies to NEW (for tested versions)
MODIFY
CMakeLists.txt
CMakeLists.txt
-cmake_minimum_required(VERSION 3.7)
-
-if(POLICY CMP0091)
- cmake_policy(SET CMP0091 NEW) # Support MSVC_RUNTIME_LIBRARY
+cmake_minimum_required(VERSION 3.10...3.20 FATAL_ERROR)
+if(${CMAKE_VERSION} VERSION_LESS 3.12)
+ # Use most recent policies, even for older cmake
+ cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
project(liblcf VERSION 0.6.2 LANGUAGES CXX)
# Deprecation handling. Remove these lines one release later.
-SET(new_params "LIBLCF_WITH_ICU;LIBLCF_WITH_XML;LIBLCF_UPDATE_MIMEDB;LIBLCF_ENABLE_TOOLS;LIBLCF_ENABLE_BENCHMARKS")
+SET(new_params "WITH_ICU;WITH_XML;UPDATE_MIMEDB;ENABLE_TOOLS;ENABLE_BENCHMARKS")
SET(old_params "DISABLE_ICU;DISABLE_XML;DISABLE_UPDATE_MIMEDB;DISABLE_TOOLS;DISABLE_BENCHMARKS")
-
foreach(x IN LISTS old_params)
if(DEFINED ${x})
list(FIND old_params ${x} index)
list(GET new_params ${index} new_value)
- message(FATAL_ERROR "${x} was renamed to ${new_value} and the logic inverted.")
+ message(FATAL_ERROR "${x} was renamed to LIBLCF_${new_value} and the logic inverted.")
endif()
endforeach()
+# Compilation options
option(BUILD_SHARED_LIBS "Build shared library, disable for building the static library (default: ON)" ON)
option(LIBLCF_WITH_ICU "ICU encoding detection (when OFF fallback to iconv, not recommended, default: ON)" ON)
option(LIBLCF_WITH_XML "XML reading support (expat, default: ON)" ON)
@@ -29,27 +29,14 @@ option(LIBLCF_ENABLE_BENCHMARKS "Whether to build the benchmarks (default: OFF)"
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Override CMAKE_DEBUG_POSTFIX.")
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/Modules)
-
include(ConfigureWindows)
-# Doxygen
-find_package(Doxygen)
-if(DOXYGEN_FOUND)
- add_custom_target(liblcf_doc
- ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/builds/Doxyfile
- DEPENDS lcf
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/builds
- COMMENT "Generating API documentation with Doxygen" VERBATIM)
-endif()
-
# C++14 is required
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
# lcf library files
-add_library(lcf)
-
set(LCF_SOURCES
src/dbarray.cpp
src/encoder.cpp
@@ -309,11 +296,7 @@ set(LCF_HEADERS
src/lcf/third_party/string_view.h
)
-list(TRANSFORM LCF_SOURCES PREPEND ${CMAKE_CURRENT_SOURCE_DIR}/)
-list(TRANSFORM LCF_HEADERS PREPEND ${CMAKE_CURRENT_SOURCE_DIR}/)
-list(APPEND LCF_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/src/lcf/config.h)
-
-target_sources(lcf PRIVATE ${LCF_SOURCES} ${LCF_HEADERS})
+add_library(lcf ${LCF_SOURCES} ${LCF_HEADERS})
# IDE source grouping
foreach(SG LDB LMT LMU LSD RPG THIRD_PARTY)
@@ -383,6 +366,7 @@ if(LIBLCF_UPDATE_MIMEDB AND NOT CMAKE_CROSSCOMPILING)
endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake.config.h.in" "src/lcf/config.h" @ONLY)
+target_sources(lcf PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src/lcf/config.h)
# .so version
set_property(TARGET lcf PROPERTY SOVERSION 0)
@@ -399,7 +383,6 @@ set(LCF_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR})
if(IS_ABSOLUTE ${LCF_INCLUDEDIR})
file(RELATIVE_PATH LCF_INCLUDEDIR ${CMAKE_INSTALL_PREFIX} ${LCF_INCLUDEDIR})
endif()
-
set(PACKAGE_TARNAME ${PROJECT_NAME})
set(PACKAGE_VERSION ${PROJECT_VERSION})
set(prefix "${CMAKE_INSTALL_PREFIX}")
@@ -435,8 +418,6 @@ install(
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/builds/liblcf-config.cmake
- ${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/Modules/FindEXPAT.cmake
- ${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/Modules/FindICU.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/liblcf)
# mime types
@@ -490,3 +471,15 @@ if(LIBLCF_ENABLE_TOOLS)
install(TARGETS ${tool} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endforeach()
endif()
+
+# Doxygen documentation
+find_package(Doxygen)
+if(DOXYGEN_FOUND)
+ add_custom_target(liblcf_doc
+ ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/builds/Doxyfile
+ DEPENDS lcf
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/builds
+ COMMENT "Generating API documentation with Doxygen" VERBATIM)
+else()
+ message(STATUS "This means no API documentation is generated.")
+endif()

MODIFY
Makefile.am
Makefile.am
@@ -10,10 +10,7 @@ mimedbdir = $(datadir)/mime/packages
mimedb_DATA = mime/liblcf.xml
cmakeconfigdir = $(libdir)/cmake/liblcf
-cmakeconfig_DATA = \
- builds/liblcf-config.cmake \
- builds/cmake/Modules/FindEXPAT.cmake \
- builds/cmake/Modules/FindICU.cmake
+cmakeconfig_DATA = builds/liblcf-config.cmake
lcfincludedir = $(includedir)/lcf
lcfldbincludedir = $(includedir)/lcf/ldb

MODIFY
README.md
README.md
@@ -67,7 +67,7 @@ https://wiki.easyrpg.org/development/compiling/liblcf/autotools
Building requirements:
- pkg-config (Not on Windows)
-- CMake
+- CMake >= 3.10
Step-by-step instructions:

DELETE
builds/cmake/Modules/FindEXPAT.cmake
-# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-#.rst:
-# FindEXPAT
-# ---------
-#
-# Find the native Expat headers and library.
-#
-# Imported Targets
-# ^^^^^^^^^^^^^^^^
-#
-# This module defines the following :prop_tgt:`IMPORTED` targets:
-#
-# ``EXPAT::EXPAT``
-# The Expat ``expat`` library, if found.
-#
-# Result Variables
-# ^^^^^^^^^^^^^^^^
-#
-# This module will set the following variables in your project:
-#
-# ``EXPAT_INCLUDE_DIRS``
-# where to find expat.h, etc.
-# ``EXPAT_LIBRARIES``
-# the libraries to link against to use Expat.
-# ``EXPAT_FOUND``
-# true if the Expat headers and libraries were found.
-#
-
-find_package(PkgConfig QUIET)
-
-pkg_check_modules(PC_EXPAT QUIET expat)
-
-# Look for the header file.
-find_path(EXPAT_INCLUDE_DIR NAMES expat.h HINTS ${PC_EXPAT_INCLUDE_DIRS})
-
-# Look for the library.
-find_library(EXPAT_LIBRARY NAMES expat libexpat HINTS ${PC_EXPAT_LIBRARY_DIRS})
-
-if (EXPAT_INCLUDE_DIR AND EXISTS "${EXPAT_INCLUDE_DIR}/expat.h")
- file(STRINGS "${EXPAT_INCLUDE_DIR}/expat.h" expat_version_str
- REGEX "^#[\t ]*define[\t ]+XML_(MAJOR|MINOR|MICRO)_VERSION[\t ]+[0-9]+$")
-
- unset(EXPAT_VERSION_STRING)
- foreach(VPART MAJOR MINOR MICRO)
- foreach(VLINE ${expat_version_str})
- if(VLINE MATCHES "^#[\t ]*define[\t ]+XML_${VPART}_VERSION[\t ]+([0-9]+)$")
- set(EXPAT_VERSION_PART "${CMAKE_MATCH_1}")
- if(EXPAT_VERSION_STRING)
- string(APPEND EXPAT_VERSION_STRING ".${EXPAT_VERSION_PART}")
- else()
- set(EXPAT_VERSION_STRING "${EXPAT_VERSION_PART}")
- endif()
- endif()
- endforeach()
- endforeach()
-endif ()
-
-include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(EXPAT
- REQUIRED_VARS EXPAT_LIBRARY EXPAT_INCLUDE_DIR
- VERSION_VAR EXPAT_VERSION_STRING)
-
-# Copy the results to the output variables and target.
-if(EXPAT_FOUND)
- set(EXPAT_LIBRARIES ${EXPAT_LIBRARY})
- set(EXPAT_INCLUDE_DIRS ${EXPAT_INCLUDE_DIR})
-
- if(NOT TARGET EXPAT::EXPAT)
- add_library(EXPAT::EXPAT UNKNOWN IMPORTED)
- set_target_properties(EXPAT::EXPAT PROPERTIES
- IMPORTED_LINK_INTERFACE_LANGUAGES "C"
- IMPORTED_LOCATION "${EXPAT_LIBRARY}"
- INTERFACE_INCLUDE_DIRECTORIES "${EXPAT_INCLUDE_DIRS}")
- endif()
-endif()
-
-mark_as_advanced(EXPAT_INCLUDE_DIR EXPAT_LIBRARY)

DELETE
builds/cmake/Modules/FindICU.cmake
-# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-#.rst:
-# FindICU
-# -------
-#
-# Find the International Components for Unicode (ICU) libraries and
-# programs.
-#
-# This module supports multiple components.
-# Components can include any of: ``data``, ``i18n``, ``io``, ``le``,
-# ``lx``, ``test``, ``tu`` and ``uc``.
-#
-# Note that on Windows ``data`` is named ``dt`` and ``i18n`` is named
-# ``in``; any of the names may be used, and the appropriate
-# platform-specific library name will be automatically selected.
-#
-# This module reports information about the ICU installation in
-# several variables. General variables::
-#
-# ICU_VERSION - ICU release version
-# ICU_FOUND - true if the main programs and libraries were found
-# ICU_LIBRARIES - component libraries to be linked
-# ICU_INCLUDE_DIRS - the directories containing the ICU headers
-#
-# Imported targets::
-#
-# ICU::<C>
-#
-# Where ``<C>`` is the name of an ICU component, for example
-# ``ICU::i18n``.
-#
-# ICU programs are reported in::
-#
-# ICU_GENCNVAL_EXECUTABLE - path to gencnval executable
-# ICU_ICUINFO_EXECUTABLE - path to icuinfo executable
-# ICU_GENBRK_EXECUTABLE - path to genbrk executable
-# ICU_ICU-CONFIG_EXECUTABLE - path to icu-config executable
-# ICU_GENRB_EXECUTABLE - path to genrb executable
-# ICU_GENDICT_EXECUTABLE - path to gendict executable
-# ICU_DERB_EXECUTABLE - path to derb executable
-# ICU_PKGDATA_EXECUTABLE - path to pkgdata executable
-# ICU_UCONV_EXECUTABLE - path to uconv executable
-# ICU_GENCFU_EXECUTABLE - path to gencfu executable
-# ICU_MAKECONV_EXECUTABLE - path to makeconv executable
-# ICU_GENNORM2_EXECUTABLE - path to gennorm2 executable
-# ICU_GENCCODE_EXECUTABLE - path to genccode executable
-# ICU_GENSPREP_EXECUTABLE - path to gensprep executable
-# ICU_ICUPKG_EXECUTABLE - path to icupkg executable
-# ICU_GENCMN_EXECUTABLE - path to gencmn executable
-#
-# ICU component libraries are reported in::
-#
-# ICU_<C>_FOUND - ON if component was found
-# ICU_<C>_LIBRARIES - libraries for component
-#
-# ICU datafiles are reported in::
-#
-# ICU_MAKEFILE_INC - Makefile.inc
-# ICU_PKGDATA_INC - pkgdata.inc
-#
-# Note that ``<C>`` is the uppercased name of the component.
-#
-# This module reads hints about search results from::
-#
-# ICU_ROOT - the root of the ICU installation
-#
-# The environment variable ``ICU_ROOT`` may also be used; the
-# ICU_ROOT variable takes precedence.
-#
-# The following cache variables may also be set::
-#
-# ICU_<P>_EXECUTABLE - the path to executable <P>
-# ICU_INCLUDE_DIR - the directory containing the ICU headers
-# ICU_<C>_LIBRARY - the library for component <C>
-#
-# .. note::
-#
-# In most cases none of the above variables will require setting,
-# unless multiple ICU versions are available and a specific version
-# is required.
-#
-# Other variables one may set to control this module are::
-#
-# ICU_DEBUG - Set to ON to enable debug output from FindICU.
-
-# Written by Roger Leigh <rleigh@codelibre.net>
-
-set(icu_programs
- gencnval
- icuinfo
- genbrk
- icu-config
- genrb
- gendict
- derb
- pkgdata
- uconv
- gencfu
- makeconv
- gennorm2
- genccode
- gensprep
- icupkg
- gencmn)
-
-set(icu_data
- Makefile.inc
- pkgdata.inc)
-
-# The ICU checks are contained in a function due to the large number
-# of temporary variables needed.
-function(_ICU_FIND)
- # Set up search paths, taking compiler into account. Search ICU_ROOT,
- # with ICU_ROOT in the environment as a fallback if unset.
- if(ICU_ROOT)
- list(APPEND icu_roots "${ICU_ROOT}")
- else()
- if(NOT "$ENV{ICU_ROOT}" STREQUAL "")
- file(TO_CMAKE_PATH "$ENV{ICU_ROOT}" NATIVE_PATH)
- list(APPEND icu_roots "${NATIVE_PATH}")
- set(ICU_ROOT "${NATIVE_PATH}"
- CACHE PATH "Location of the ICU installation" FORCE)
- endif()
- endif()
-
- # Find include directory
- list(APPEND icu_include_suffixes "include")
- find_path(ICU_INCLUDE_DIR
- NAMES "unicode/utypes.h"
- HINTS ${icu_roots}
- PATH_SUFFIXES ${icu_include_suffixes}
- DOC "ICU include directory")
- set(ICU_INCLUDE_DIR "${ICU_INCLUDE_DIR}" PARENT_SCOPE)
-
- # Get version
- if(ICU_INCLUDE_DIR AND EXISTS "${ICU_INCLUDE_DIR}/unicode/uvernum.h")
- file(STRINGS "${ICU_INCLUDE_DIR}/unicode/uvernum.h" icu_header_str
- REGEX "^#define[\t ]+U_ICU_VERSION[\t ]+\".*\".*")
-
- string(REGEX REPLACE "^#define[\t ]+U_ICU_VERSION[\t ]+\"([^ \\n]*)\".*"
- "\\1" icu_version_string "${icu_header_str}")
- set(ICU_VERSION "${icu_version_string}")
- set(ICU_VERSION "${icu_version_string}" PARENT_SCOPE)
- unset(icu_header_str)
- unset(icu_version_string)
- endif()
-
- if(CMAKE_SIZEOF_VOID_P EQUAL 8)
- # 64-bit binary directory
- set(_bin64 "bin64")
- # 64-bit library directory
- set(_lib64 "lib64")
- endif()
-
-
- # Find all ICU programs
- list(APPEND icu_binary_suffixes "${_bin64}" "bin" "sbin")
- foreach(program ${icu_programs})
- string(TOUPPER "${program}" program_upcase)
- set(cache_var "ICU_${program_upcase}_EXECUTABLE")
- set(program_var "ICU_${program_upcase}_EXECUTABLE")
- find_program("${cache_var}" "${program}"
- HINTS ${icu_roots}
- PATH_SUFFIXES ${icu_binary_suffixes}
- DOC "ICU ${program} executable")
- mark_as_advanced(cache_var)
- set("${program_var}" "${${cache_var}}" PARENT_SCOPE)
- endforeach()
-
- # Find all ICU libraries
- list(APPEND icu_library_suffixes "${_lib64}" "lib")
- set(ICU_REQUIRED_LIBS_FOUND ON)
- set(static_prefix )
- # static icu libraries compiled with MSVC have the prefix 's'
- if(MSVC)
- set(static_prefix "s")
- endif()
- foreach(component ${ICU_FIND_COMPONENTS})
- string(TOUPPER "${component}" component_upcase)
- set(component_cache "ICU_${component_upcase}_LIBRARY")
- set(component_cache_release "${component_cache}_RELEASE")
- set(component_cache_debug "${component_cache}_DEBUG")
- set(component_found "${component_upcase}_FOUND")
- set(component_libnames "icu${component}")
- set(component_debug_libnames "icu${component}d")
-
- # Special case deliberate library naming mismatches between Unix
- # and Windows builds
- unset(component_libnames)
- unset(component_debug_libnames)
- list(APPEND component_libnames "icu${component}")
- list(APPEND component_debug_libnames "icu${component}d")
- if(component STREQUAL "data")
- list(APPEND component_libnames "icudt")
- # Note there is no debug variant at present
- list(APPEND component_debug_libnames "icudtd")
- endif()
- if(component STREQUAL "dt")
- list(APPEND component_libnames "icudata")
- # Note there is no debug variant at present
- list(APPEND component_debug_libnames "icudatad")
- endif()
- if(component STREQUAL "i18n")
- list(APPEND component_libnames "icuin")
- list(APPEND component_debug_libnames "icuind")
- endif()
- if(component STREQUAL "in")
- list(APPEND component_libnames "icui18n")
- list(APPEND component_debug_libnames "icui18nd")
- endif()
-
- if(static_prefix)
- unset(static_component_libnames)
- unset(static_component_debug_libnames)
- foreach(component_libname ${component_libnames})
- list(APPEND static_component_libnames
- ${static_prefix}${component_libname})
- endforeach()
- foreach(component_libname ${component_debug_libnames})
- list(APPEND static_component_debug_libnames
- ${static_prefix}${component_libname})
- endforeach()
- list(APPEND component_libnames ${static_component_libnames})
- list(APPEND component_debug_libnames ${static_component_debug_libnames})
- endif()
- find_library("${component_cache_release}" ${component_libnames}
- HINTS ${icu_roots}
- PATH_SUFFIXES ${icu_library_suffixes}
- DOC "ICU ${component} library (release)")
- find_library("${component_cache_debug}" ${component_debug_libnames}
- HINTS ${icu_roots}
- PATH_SUFFIXES ${icu_library_suffixes}
- DOC "ICU ${component} library (debug)")
- include(SelectLibraryConfigurations)
- select_library_configurations(ICU_${component_upcase})
- mark_as_advanced("${component_cache_release}" "${component_cache_debug}")
- if(${component_cache})
- set("${component_found}" ON)
- list(APPEND ICU_LIBRARY "${${component_cache}}")
- endif()
- mark_as_advanced("${component_found}")
- set("${component_cache}" "${${component_cache}}" PARENT_SCOPE)
- set("${component_found}" "${${component_found}}" PARENT_SCOPE)
- if(${component_found})
- if (ICU_FIND_REQUIRED_${component})
- list(APPEND ICU_LIBS_FOUND "${component} (required)")
- else()
- list(APPEND ICU_LIBS_FOUND "${component} (optional)")
- endif()
- else()
- if (ICU_FIND_REQUIRED_${component})
- set(ICU_REQUIRED_LIBS_FOUND OFF)
- list(APPEND ICU_LIBS_NOTFOUND "${component} (required)")
- else()
- list(APPEND ICU_LIBS_NOTFOUND "${component} (optional)")
- endif()
- endif()
- endforeach()
- set(_ICU_REQUIRED_LIBS_FOUND "${ICU_REQUIRED_LIBS_FOUND}" PARENT_SCOPE)
- set(ICU_LIBRARY "${ICU_LIBRARY}" PARENT_SCOPE)
-
- # Find all ICU data files
- if(CMAKE_LIBRARY_ARCHITECTURE)
- list(APPEND icu_data_suffixes
- "${_lib64}/${CMAKE_LIBRARY_ARCHITECTURE}/icu/${ICU_VERSION}"
- "lib/${CMAKE_LIBRARY_ARCHITECTURE}/icu/${ICU_VERSION}"
- "${_lib64}/${CMAKE_LIBRARY_ARCHITECTURE}/icu"
- "lib/${CMAKE_LIBRARY_ARCHITECTURE}/icu")
- endif()
- list(APPEND icu_data_suffixes
- "${_lib64}/icu/${ICU_VERSION}"
- "lib/icu/${ICU_VERSION}"
- "${_lib64}/icu"
- "lib/icu")
- foreach(data ${icu_data})
- string(TOUPPER "${data}" data_upcase)
- string(REPLACE "." "_" data_upcase "${data_upcase}")
- set(cache_var "ICU_${data_upcase}")
- set(data_var "ICU_${data_upcase}")
- find_file("${cache_var}" "${data}"
- HINTS ${icu_roots}
- PATH_SUFFIXES ${icu_data_suffixes}
- DOC "ICU ${data} data file")
- mark_as_advanced(cache_var)
- set("${data_var}" "${${cache_var}}" PARENT_SCOPE)
- endforeach()
-
- if(NOT ICU_FIND_QUIETLY)
- if(ICU_LIBS_FOUND)
- message(STATUS "Found the following ICU libraries:")
- foreach(found ${ICU_LIBS_FOUND})
- message(STATUS " ${found}")
- endforeach()
- endif()
- if(ICU_LIBS_NOTFOUND)
- message(STATUS "The following ICU libraries were not found:")
- foreach(notfound ${ICU_LIBS_NOTFOUND})
- message(STATUS " ${notfound}")
- endforeach()
- endif()
- endif()
-
- if(ICU_DEBUG)
- message(STATUS "--------FindICU.cmake search debug--------")
- message(STATUS "ICU binary path search order: ${icu_roots}")
- message(STATUS "ICU include path search order: ${icu_roots}")
- message(STATUS "ICU library path search order: ${icu_roots}")
- message(STATUS "----------------")
- endif()
-endfunction()
-
-_ICU_FIND()
-
-include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(ICU
- FOUND_VAR ICU_FOUND
- REQUIRED_VARS ICU_INCLUDE_DIR
- ICU_LIBRARY
- _ICU_REQUIRED_LIBS_FOUND
- VERSION_VAR ICU_VERSION
- FAIL_MESSAGE "Failed to find all ICU components")
-
-unset(_ICU_REQUIRED_LIBS_FOUND)
-
-if(ICU_FOUND)
- set(ICU_INCLUDE_DIRS "${ICU_INCLUDE_DIR}")
- set(ICU_LIBRARIES "${ICU_LIBRARY}")
- foreach(_ICU_component ${ICU_FIND_COMPONENTS})
- string(TOUPPER "${_ICU_component}" _ICU_component_upcase)
- set(_ICU_component_cache "ICU_${_ICU_component_upcase}_LIBRARY")
- set(_ICU_component_cache_release "ICU_${_ICU_component_upcase}_LIBRARY_RELEASE")
- set(_ICU_component_cache_debug "ICU_${_ICU_component_upcase}_LIBRARY_DEBUG")
- set(_ICU_component_lib "ICU_${_ICU_component_upcase}_LIBRARIES")
- set(_ICU_component_found "${_ICU_component_upcase}_FOUND")
- set(_ICU_imported_target "ICU::${_ICU_component}")
- if(${_ICU_component_found})
- set("${_ICU_component_lib}" "${${_ICU_component_cache}}")
- if(NOT TARGET ${_ICU_imported_target})
- add_library(${_ICU_imported_target} UNKNOWN IMPORTED)
- if(ICU_INCLUDE_DIR)
- set_target_properties(${_ICU_imported_target} PROPERTIES
- INTERFACE_INCLUDE_DIRECTORIES "${ICU_INCLUDE_DIR}")
- endif()
- if(EXISTS "${${_ICU_component_cache}}")
- set_target_properties(${_ICU_imported_target} PROPERTIES
- IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
- IMPORTED_LOCATION "${${_ICU_component_cache}}")
- endif()
- if(EXISTS "${${_ICU_component_cache_release}}")
- set_property(TARGET ${_ICU_imported_target} APPEND PROPERTY
- IMPORTED_CONFIGURATIONS RELEASE)
- set_target_properties(${_ICU_imported_target} PROPERTIES
- IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
- IMPORTED_LOCATION_RELEASE "${${_ICU_component_cache_release}}")
- endif()
- if(EXISTS "${${_ICU_component_cache_debug}}")
- set_property(TARGET ${_ICU_imported_target} APPEND PROPERTY
- IMPORTED_CONFIGURATIONS DEBUG)
- set_target_properties(${_ICU_imported_target} PROPERTIES
- IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
- IMPORTED_LOCATION_DEBUG "${${_ICU_component_cache_debug}}")
- endif()
- endif()
- endif()
- unset(_ICU_component_upcase)
- unset(_ICU_component_cache)
- unset(_ICU_component_lib)
- unset(_ICU_component_found)
- unset(_ICU_imported_target)
- endforeach()
-endif()
-
-if(ICU_DEBUG)
- message(STATUS "--------FindICU.cmake results debug--------")
- message(STATUS "ICU found: ${ICU_FOUND}")
- message(STATUS "ICU_VERSION number: ${ICU_VERSION}")
- message(STATUS "ICU_ROOT directory: ${ICU_ROOT}")
- message(STATUS "ICU_INCLUDE_DIR directory: ${ICU_INCLUDE_DIR}")
- message(STATUS "ICU_LIBRARIES: ${ICU_LIBRARIES}")
-
- foreach(program IN LISTS icu_programs)
- string(TOUPPER "${program}" program_upcase)
- set(program_lib "ICU_${program_upcase}_EXECUTABLE")
- message(STATUS "${program} program: ${${program_lib}}")
- unset(program_upcase)
- unset(program_lib)
- endforeach()
-
- foreach(data IN LISTS icu_data)
- string(TOUPPER "${data}" data_upcase)
- string(REPLACE "." "_" data_upcase "${data_upcase}")
- set(data_lib "ICU_${data_upcase}")
- message(STATUS "${data} data: ${${data_lib}}")
- unset(data_upcase)
- unset(data_lib)
- endforeach()
-
- foreach(component IN LISTS ICU_FIND_COMPONENTS)
- string(TOUPPER "${component}" component_upcase)
- set(component_lib "ICU_${component_upcase}_LIBRARIES")
- set(component_found "${component_upcase}_FOUND")
- message(STATUS "${component} library found: ${${component_found}}")
- message(STATUS "${component} library: ${${component_lib}}")
- unset(component_upcase)
- unset(component_lib)
- unset(component_found)
- endforeach()
- message(STATUS "----------------")
-endif()
-
-unset(icu_programs)

MODIFY
builds/liblcf-config.cmake.in
builds/liblcf-config.cmake.in
@@ -66,11 +66,6 @@ if(LIBLCF_FOUND)
if(NOT TARGET liblcf::liblcf)
add_library(liblcf::liblcf UNKNOWN IMPORTED)
- if(${CMAKE_VERSION} VERSION_LESS "3.10")
- include("${CMAKE_CURRENT_LIST_DIR}/FindICU.cmake")
- include("${CMAKE_CURRENT_LIST_DIR}/FindEXPAT.cmake")
- endif()
-
set(LIBLCF_LIBRARY_DEPS "@AX_PACKAGE_REQUIRES_PRIVATE@")
string(REPLACE " " ";" LIBLCF_LIBRARY_DEPS "${LIBLCF_LIBRARY_DEPS}")

Small cmake touch-up:
- Set minimal version to 3.10, remove older modules
- Support cmake older than 3.12 (no list transform)
- Explain missing doxygen (avoid user confusion)
- Set all policies to NEW (for tested versions)