最小cmake文件
用于编译 Kaleidoscope 的。
cmake_minimum_required(VERSION 3.8)
include(ProcessorCount)
project(hello)
find_package(LLVM REQUIRED CONFIG)
add_executable(test toy.cpp)
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
# Set your project compile flags.
# E.g. if using the C++ header files
# you will need to enable C++11 support for your compiler.
include_directories(${LLVM_INCLUDE_DIRS})
add_definitions(${LLVM_DEFINITIONS})
# 找到与我们希望使用的LLVM组件相对应的库
llvm_map_components_to_libnames(llvm_libs
Analysis Core ExecutionEngine InstCombine Object OrcJIT RuntimeDyld ScalarOpts Support native
)
# Link against LLVM libraries
target_link_libraries(test ${llvm_libs})