-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Labels
Description
Check duplicate issues.
- Checked for duplicates
Description
In CMake, find_package can be used to find optional packages. For instance,
find_package(ROOT)finds ROOT if it is there, and keeps going if not (setting ROOT_FOUND to FALSE).
Likewise,
find_package(ROOT COMPONENTS OptionalComponent)
should create the ROOT::OptionalComponent target if it was compiled in, and keep going otherwise (with, again, ROOT_FOUND set to FALSE).
Instead, ROOT raises an error, which aborts CMake.
Reproducer
- Create a
CMakeLists.txtwith:cmake_minimum_required(3.0 FATAL_ERROR) project(test VERSION 1.0) find_package(ROOT COMPONENTS Unfold)
- Run CMake against ROOT compiled with and without the Unfold component.
With ROOT compiled without TUnfold, you will get the following message:
CMake Error at $ROOTDIR/cmake/ROOTConfig.cmake:226 (message):
ROOT component Unfold not found
Call Stack (most recent call first):
CMakeLists.txt:3 (find_package)
-- Configuring incomplete, errors occurred!
ROOT version
------------------------------------------------------------------
| Welcome to ROOT 6.36.02 https://root.cern |
| (c) 1995-2025, The ROOT Team; conception: R. Brun, F. Rademakers |
| Built for linuxx8664gcc on Jul 10 2025, 23:34:46 |
| From tags/6-36-02@6-36-02 |
| With g++ (GCC) 14.2.0 |
| Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q' |
------------------------------------------------------------------
Installation method
LCG 108, micromamba
Operating system
Linux (RHEL 9, micromamba)
Additional context
No response