Added LLVM to CMakeLists.txt

This commit is contained in:
apio 2022-06-07 17:37:03 +02:00
parent 60059e1091
commit 19b32214a4

View File

@ -1,8 +1,17 @@
cmake_minimum_required(VERSION 3.8...3.22) cmake_minimum_required(VERSION 3.8...3.22)
project(sapphire-compiler LANGUAGES CXX) project(sapphire-compiler LANGUAGES CXX C)
set(CXX_STANDARD_REQUIRED 17) set(CXX_STANDARD_REQUIRED 17)
find_package(LLVM REQUIRED CONFIG)
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
include_directories(${LLVM_INCLUDE_DIRS})
separate_arguments(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS})
add_definitions(${LLVM_DEFINITIONS_LIST})
add_executable( add_executable(
sapphirec sapphirec
src/sapphire.cpp src/sapphire.cpp
@ -47,3 +56,8 @@ add_executable(
target_include_directories(sapphirec PUBLIC src) target_include_directories(sapphirec PUBLIC src)
target_include_directories(sapphirec PUBLIC src/tclap-1.2.5/include) target_include_directories(sapphirec PUBLIC src/tclap-1.2.5/include)
llvm_map_components_to_libnames(llvm_libs support core irreader)
# Link against LLVM libraries
target_link_libraries(sapphirec ${llvm_libs})