Skip to content

Commit

Permalink
Add better checks for llvm version
Browse files Browse the repository at this point in the history
- Allow the user to specify a specific llvm version
- Check that the chosen version of llvm is actually supported
  • Loading branch information
gslavin committed Mar 28, 2019
1 parent d48cd6e commit 4fe081e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion CMakeLists.txt
Expand Up @@ -65,7 +65,18 @@ set(CMAKE_EXTRA_INCLUDE_FILES linux/bpf.h)
check_type_size("BPF_FUNC_get_current_cgroup_id" GET_CURRENT_CGROUP_ID LANGUAGE C)
set(CMAKE_EXTRA_INCLUDE_FILES)

find_package(LLVM REQUIRED)
# Some users have multiple versions of llvm installed and would like to specify
# a specific llvm version.
if(${LLVM_REQUESTED_VERION})
find_package(LLVM ${LLVM_REQUESTED_VERION} REQUIRED)
else()
find_package(LLVM REQUIRED)
endif()

if(${LLVM_VERSION_MAJOR} VERSION_LESS 5)
message(SEND_ERROR "Unsupported LLVM version found: ${LLVM_INCLUDE_DIRS}")
endif()

include_directories(SYSTEM ${LLVM_INCLUDE_DIRS})
add_definitions(${LLVM_DEFINITIONS})

Expand Down

0 comments on commit 4fe081e

Please sign in to comment.