Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Friedrich W. H. Kossebau
kdevelop
Commits
2e1fcb89
Commit
2e1fcb89
authored
Apr 07, 2014
by
Kevin Funk
☕
Browse files
Also detect llvm-config from build tree
parent
8bb6a41a
Changes
2
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
2e1fcb89
...
...
@@ -18,7 +18,7 @@ macro_log_feature(CLANG_FOUND "libclang" "LibClang is a high level C interface t
add_definitions
(
${
LLVM_CFLAGS
}
)
include_directories
(
${
LLVM
_INCLUDE_DIR
}
${
CLANG
_INCLUDE_DIR
}
)
if
(
CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL
"Clang"
OR CMAKE_CXX_COMPILER_ID STREQUAL
"Intel"
)
...
...
cmake/FindClang.cmake
View file @
2e1fcb89
# Detect Clang libraries
#
# Defines the following variables:
# CLANG_FOUND - True if Clang was found
# CLANG_INCLUDE_DIR - Where to find Clang includes
# CLANG_LIBRARY_DIR - Where to find Clang libraries
#
# CLANG_CLANG_LIB - LibClang library
# CLANG_CLANGFRONTEND_LIB - Clang Frontend Library
# CLANG_CLANGDRIVER_LIB - Clang Driver Library
...
...
@@ -19,6 +23,7 @@
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
find_package
(
LLVM
${
Clang_FIND_VERSION
}
${
Clang_FIND_REQUIRED
}
)
...
...
@@ -28,7 +33,7 @@ set(CLANG_FOUND FALSE)
if
(
LLVM_FOUND AND LLVM_LIBRARY_DIR
)
macro
(
FIND_AND_ADD_CLANG_LIB _libname_
)
string
(
TOUPPER
${
_libname_
}
_prettylibname_
)
find_library
(
CLANG_
${
_prettylibname_
}
_LIB
${
_libname_
}
${
LLVM_LIBRARY_DIR
}
${
CLANG_LIB_DIR
}
)
find_library
(
CLANG_
${
_prettylibname_
}
_LIB
${
_libname_
}
${
LLVM_LIBRARY_DIR
}
)
if
(
CLANG_
${
_prettylibname_
}
_LIB
)
set
(
CLANG_LIBS
${
CLANG_LIBS
}
${
CLANG_
${
_prettylibname_
}
_LIB
}
)
endif
()
...
...
@@ -66,8 +71,24 @@ else()
endif
()
if
(
CLANG_FOUND
)
message
(
STATUS
"Found Clang:
${
LLVM_INCLUDE_DIR
}
"
)
message
(
STATUS
" Libraries:
${
CLANG_LIBS
}
"
)
set
(
CLANG_LIBRARY_DIR
${
LLVM_LIBRARY_DIR
}
)
set
(
CLANG_INCLUDE_DIR
${
LLVM_INCLUDE_DIR
}
)
# check whether llvm-config comes from an install prefix
execute_process
(
COMMAND
${
LLVM_CONFIG_EXECUTABLE
}
--src-root
OUTPUT_VARIABLE _llvmSourceRoot
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string
(
FIND
"
${
LLVM_INCLUDE_DIR
}
"
"
${
_llvmSourceRoot
}
"
_llvmIsInstalled
)
if
(
NOT _llvmIsInstalled
)
message
(
STATUS
"Detected that llvm-config comes from a build-tree, adding includes from source dir"
)
list
(
APPEND CLANG_INCLUDE_DIR
"
${
_llvmSourceRoot
}
/tools/clang/include"
)
endif
()
message
(
STATUS
"Found Clang (LLVM version:
${
LLVM_VERSION
}
"
)
message
(
STATUS
" Include dirs:
${
CLANG_INCLUDE_DIR
}
"
)
message
(
STATUS
" Libraries:
${
CLANG_LIBS
}
"
)
else
()
if
(
Clang_FIND_REQUIRED
)
message
(
FATAL_ERROR
"Could NOT find Clang"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment