cmake_minimum_required(VERSION 2.8.7)

project(bpf-tools)
set(CMAKE_BUILD_TYPE Debug)

enable_testing()

find_package(BISON)
find_package(FLEX)
find_package(LLVM REQUIRED CONFIG)
message(STATUS "Found LLVM: ${LLVM_INCLUDE_DIRS}")
find_program(XXD xxd)
if (${XXD} STREQUAL "XXD-NOTFOUND")
  message(FATAL_ERROR "program xxd not found, install vim-common")
endif()
find_program(CLANG clang)
if (${CLANG} STREQUAL "CLANG-NOTFOUND")
  message(FATAL_ERROR "program clang not found, install clang with bpf support")
endif()
execute_process(COMMAND ${CLANG} --version OUTPUT_VARIABLE CLANG_VERSION_RAW)
string(REGEX MATCH "[0-9]+[.][0-9]+[.][0-9]+" CLANG_VERSION ${CLANG_VERSION_RAW})
message(STATUS "Found CLANG: ${CLANG} (found version \"${CLANG_VERSION}\")")
if (CLANG_VERSION VERSION_LESS 3.5.0)
  message(FATAL_ERROR "requires clang version >= 3.5.0, ${CLANG_VERSION} found")
endif()

set(CMAKE_C_FLAGS "-Wall")
set(CMAKE_CXX_FLAGS "-std=c++11 -Wall")

add_subdirectory(src)
add_subdirectory(tests)

cmake_minimum_required(VERSION 2.8.7)

project(bpf-tools)
set(CMAKE_BUILD_TYPE Debug)

enable_testing()

find_package(BISON)
find_package(FLEX)
find_package(LLVM REQUIRED CONFIG)
message(STATUS "Found LLVM: ${LLVM_INCLUDE_DIRS}")
find_program(XXD xxd)
if (${XXD} STREQUAL "XXD-NOTFOUND")
  message(FATAL_ERROR "program xxd not found, install vim-common")
endif()
find_program(CLANG clang)
if (${CLANG} STREQUAL "CLANG-NOTFOUND")
  message(FATAL_ERROR "program clang not found, install clang with bpf support")
endif()
execute_process(COMMAND ${CLANG} --version OUTPUT_VARIABLE CLANG_VERSION_RAW)
string(REGEX MATCH "[0-9]+[.][0-9]+[.][0-9]+" CLANG_VERSION ${CLANG_VERSION_RAW})
message(STATUS "Found CLANG: ${CLANG} (found version \"${CLANG_VERSION}\")")
if (CLANG_VERSION VERSION_LESS 3.0.0)
  message(FATAL_ERROR "requires clang version >= 3.0.0, ${CLANG_VERSION} found")
endif()

set(CMAKE_C_FLAGS "-Wall")
set(CMAKE_CXX_FLAGS "-std=c++11 -Wall")

add_subdirectory(src)
add_subdirectory(tests)

Reduce strength of clang requirement to 3.0
Reduce strength of clang requirement to 3.0

* All that is required is that clang binary IR is compatible
  with llvm 3.7.

Signed-off-by: Brenden Blanco <8e41c261aa8ddb01230a40c21c26a049c1f6d041@plumgrid.com>
