cmake_minimum_required(VERSION 3.15) project(llvm-orc-jit) add_executable(main main.cc) # Enable warnings / warnings as errors. target_compile_options(main PRIVATE -Wall -Wextra -Werror) # -- LLVM/CLANG ---------------------------------------------------------------- find_package(Clang REQUIRED CONFIG HINTS "${CLANG_INSTALL_PREFIX}/lib/cmake/clang") if (NOT ${CLANG_INSTALL_PREFIX} STREQUAL "/") # Treat custom LLVM/CLANG include path as system include path, such that # warnings are suppressed for those header files. target_include_directories(main SYSTEM PRIVATE ${CLANG_INCLUDE_DIRS}) endif() target_link_libraries(main clang-cpp) message(STATUS "Using LLVMConfig.cmake: ${LLVM_CONFIG}") message(STATUS "LLVM version: ${LLVM_VERSION}") message(STATUS "Using ClangConfig.cmake: ${Clang_CONFIG}") message(STATUS "Clang version: ${Clang_VERSION}") # -- SANITIZER ----------------------------------------------------------------- option(SANITIZER "Enable ASAN/LSAN/UBSAN" ON) if (SANITIZER) target_compile_options(main PRIVATE -fsanitize=address -fsanitize=leak -fsanitize=undefined -fno-rtti) target_link_options(main PRIVATE -fsanitize=address -fsanitize=leak -fsanitize=undefined) endif()