would it be possible to improve the compatibility between the CMake config file included in liblzma and the FindLibLZMA.cmake module included in CMake?

The CMake config file currently only defines a liblzma::liblzma target, while the CMake module defines a LibLZMA::LibLZMA target. On systems with case-insensitive file systems, using CMAKE_FIND_PACKAGE_PREFER_CONFIG (see [1]) to prefer config files over modules results in an error because of this. A find_package(LibLZMA) call now also uses the config file, which however does not define the expected LibLZMA::LibLZMA target.

This could be solved by adding an alias to the config file:
add_library(LibLZMA::LibLZMA ALIAS liblzma::liblzma)

An additional improvement would be to enable this on case-sensitive file systems as well. For this, the config file would need to be renamed from liblzmaConfig.cmake to liblzma-config.cmake (and the version file to liblzma-config-version.cmake), see [2]. This would support using both find_package(LibLZMA) and find_package(liblzma), while still preferring the CMake module by default in the first case.

Best regards,

Markus Rickert

[1] https://cmake.org/cmake/help/v3.19/variable/CMAKE_FIND_PACKAGE_PREFER_CONFIG.html [2] https://cmake.org/cmake/help/v3.19/command/find_package.html#full-signature-and-config-mode

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to