Skip to content
Snippets Groups Projects
Commit 716372ae authored by Bernd Buschinski's avatar Bernd Buschinski
Browse files

Use CLANG_INCLUDE_DIRS for clang include dir

Summary:
Use CLANG_INCLUDE_DIRS for clang include dir instead of manually building it.

This fixes the error:
kdevplatform.shell: Could not load plugin "kdevclangsupport" , it reported the error: "The clang builtin include path \"/usr/lib64/llvm/7/lib64/clang/7.0.0/include\" is invalid (missing cpuid.h header).\nTry setting the KDEV_CLANG_BUILTIN_DIR environment variable manually to fix this.\nSee also: https://bugs.kde.org/show_bug.cgi?id=393779" Disabling the plugin now.

As CMake with CLANG_INCLUDE_DIRS already tests if this folder is present, it should work across all distros.

CCBUG: 393779

Reviewers: #kdevelop, kfunk

Reviewed By: #kdevelop, kfunk

Subscribers: mwolff, aaronpuchert, brauch, kossebau, kfunk, arrowd, kdevelop-devel

Tags: #kdevelop

Differential Revision: https://phabricator.kde.org/D15895
parent beae0686
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@
# CLANG_FOUND - True if Clang was found
# CLANG_INCLUDE_DIRS - Where to find Clang includes
# CLANG_LIBRARY_DIRS - Where to find Clang libraries
# CLANG_BUILTIN_DIR - Where to find Clang builtin includes
#
# CLANG_CLANG_LIB - Libclang C library
#
......@@ -92,6 +93,21 @@ if(CLANG_FOUND)
set(CLANG_INCLUDE_DIRS ${LLVM_INCLUDE_DIRS})
set(CLANG_VERSION ${LLVM_VERSION})
find_path(CLANG_BUILTIN_DIR
# cpuid.h because it is defined in ClangSupport constructor as valid clang builtin dir indicator
NAMES "cpuid.h"
PATHS "${CLANG_LIBRARY_DIRS}"
"${CLANG_INCLUDE_DIRS}"
PATH_SUFFIXES "clang/${CLANG_VERSION}/include"
"../../../clang/${CLANG_VERSION}/include"
NO_DEFAULT_PATH
)
if (NOT CLANG_BUILTIN_DIR)
message(FATAL_ERROR "Could not find Clang builtin directory")
endif()
get_filename_component(CLANG_BUILTIN_DIR ${CLANG_BUILTIN_DIR} ABSOLUTE)
# check whether llvm-config comes from an install prefix
execute_process(
COMMAND ${LLVM_CONFIG_EXECUTABLE} --src-root
......@@ -108,9 +124,10 @@ if(CLANG_FOUND)
endif()
message(STATUS "Found Clang (LLVM version: ${CLANG_VERSION})")
message(STATUS " Include dirs: ${CLANG_INCLUDE_DIRS}")
message(STATUS " Clang libraries: ${CLANG_LIBS}")
message(STATUS " Libclang C library: ${CLANG_CLANG_LIB}")
message(STATUS " Include dirs: ${CLANG_INCLUDE_DIRS}")
message(STATUS " Clang libraries: ${CLANG_LIBS}")
message(STATUS " Libclang C library: ${CLANG_CLANG_LIB}")
message(STATUS " Builtin include dir: ${CLANG_BUILTIN_DIR}")
else()
if(Clang_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find Clang")
......
......@@ -19,4 +19,4 @@
Boston, MA 02110-1301, USA.
*/
#define KDEV_CLANG_BUILTIN_DIR "@CLANG_LIBRARY_DIRS@/clang/@CLANG_VERSION@/include"
#define KDEV_CLANG_BUILTIN_DIR "@CLANG_BUILTIN_DIR@"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment