using find_package(Clang) in CMakeLists.txt returns the wrong CLANG_INSTALL_PREFIX and CLANG_INCLUDE_DIRS Reproducible: Always Steps to Reproduce: 1. Create an minimum reproducing unit: $cat CMakeLists.txt: project(test) cmake_minimum_required(VERSION 3.22) find_package(Clang) message("CLANG_INSTALL_PREFIX=${CLANG_INSTALL_PREFIX}") message("CLANG_INCLUDE_DIRS=${CLANG_INCLUDE_DIRS}") add_executable(hello hello.c) $cat helloc hello.c: empty 2. mkdir build; cd build; cmake .. -G Ninja 3. Find out that CLANG_INSTALL_PREFIX and CLANG_INCLUDE_DIRS are wrong: Actual Results: -- The C compiler identification is GNU 11.3.1 -- The CXX compiler identification is GNU 11.3.1 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Performing Test HAVE_FFI_CALL -- Performing Test HAVE_FFI_CALL - Success -- Found FFI: /opt/gentoo/usr/lib64/libffi.so -- Performing Test Terminfo_LINKABLE -- Performing Test Terminfo_LINKABLE - Success -- Found Terminfo: /usr/lib64/libtinfo.so -- Found ZLIB: /usr/lib64/libz.so (found version "1.2.11") CLANG_INSTALL_PREFIX=/usr/lib/llvm/14 CLANG_INCLUDE_DIRS=/usr/lib/llvm/14/include -- Configuring done -- Generating done -- Build files have been written to: /tmp/cm/build Expected Results: CLANG_INSTALL_PREFIX should be /opt/gentoo/usr/lib/clang/<version>
While /usr/lib/llvm/14/include/clang is one of the clang include dir, but what about /usr/lib/clang/14.0.5/include?
CLANG_RESOURCE_DIR is pointing to the correct location. So I suppose this bug can be closed.
(In reply to Yiyang Wu from comment #2) > CLANG_RESOURCE_DIR is pointing to the correct location. So I suppose this > bug can be closed. Oh CLANG_RESOURCE_DIR is defined in a header, not in cmake. Reopen this ticket.