find_package(charls 2.2.0 REQUIRED) not working
malaterre opened this issue · 5 comments
Not clear if the issue is upstream or in Debian package. But:
cmake_minimum_required(VERSION 3.18)
project(p)
find_package(charls 2.2.0 REQUIRED)
lead to:
CMake Error at CMakeLists.txt:3 (find_package):
Could not find a configuration file for package "charls" that is compatible
with requested version "2.2.0".The following configuration files were considered but not accepted:
/usr/lib/x86_64-linux-gnu/cmake/charls/charlsConfig.cmake, version: unknown /lib/x86_64-linux-gnu/cmake/charls/charlsConfig.cmake, version: unknown
-- Configuring incomplete, errors occurred!
See also "/tmp/a/bin/CMakeFiles/CMakeOutput.log".
For reference:
@vbaderks I believe the following "modern" cmake project is doing the right thing with regard to version export (cmake config file stuff).
Based on the provided cmake URL link, I think that the current CharLS CMake scripts miss some steps to create the correct package.
You may want to export version-config file.
https://cmake.org/cmake/help/latest/guide/importing-exporting/index.html#creating-a-package-version-file
https://cmake.org/cmake/help/latest/command/find_package.html#version-selection
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/charlsConfigVersion.cmake"
VERSION "${version}"
COMPATIBILITY AnyNewerVersion
)