Your CMakeLists.txt
should find and link LLVM libraries. For example:
cmake_minimum_required(VERSION 3.15)
project(MyDSL)
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})
add_definitions(${LLVM_DEFINITIONS})
set(SOURCE_FILES
src/main.cpp
src/Lexer.cpp
src/Parser.cpp
src/AST.cpp
src/CodeGen.cpp
)
add_executable(mydsl ${SOURCE_FILES})
llvm_map_components_to_libnames(llvm_libs support core irreader nativecodegen)
target_link_libraries(mydsl ${llvm_libs})