Bug 279731 - devel/cmake: find_package(LLVM 18 REQUIRED CONFIG) fails to find llvm18-18.1.6
Summary: devel/cmake: find_package(LLVM 18 REQUIRED CONFIG) fails to find llvm18-18.1.6
Status: Closed Not A Bug
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-kde (group)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-14 10:01 UTC by Yuri Victorovich
Modified: 2024-06-16 03:10 UTC (History)
1 user (show)

See Also:
jhale: maintainer-feedback+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Victorovich freebsd_committer freebsd_triage 2024-06-14 10:01:48 UTC
When these 2 llvm packages are installed:
$ pkg info | grep llvm
llvm15-15.0.7_10               LLVM and Clang
llvm18-18.1.6_1                LLVM and Clang

This cmake script fails to find llvm18:
$ cat CMakeLists.txt 
cmake_minimum_required(VERSION 3.18.0)
find_package(LLVM 18 REQUIRED CONFIG)

Error:
Make Error at CMakeLists.txt:2 (find_package):
  Could not find a configuration file for package "LLVM" that is compatible
  with requested version "18".

  The following configuration files were considered but not accepted:

    /usr/local/llvm15/lib/cmake/llvm/LLVMConfig.cmake, version: 15.0.7
    /usr/local/llvm18/lib/cmake/llvm/LLVMConfig.cmake, version: 18.1.6


It is unclear why is llvm18-18.1.6 not compatible with the requirement "18" for LLVM.

14.1-STABLE

cmake-3.29.3                   Meta-port to connect all CMake bits
cmake-core-3.29.3              Cross-platform Makefile generator
Comment 1 Jason E. Hale freebsd_committer freebsd_triage 2024-06-16 03:10:34 UTC
From ${LOCALBASE}/llvm18/lib/cmake/llvm/LLVMConfigVersion.cmake: "LLVM is API-compatible only with matching major.minor versions and patch versions not less than that requested."

So, requesting version 18 (18.0) will not satisfy this condition. Use 18.1 for the version check instead.

See also: https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-version-selection