blob: 04fe617dc90bdd39663bcba784007e0c4826c799 (
plain) (
tree)
|
|
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 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)
# -- 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()
|