diff options
Diffstat (limited to 'content/2022-07-07-llvm-orc-jit/CMakeLists.txt')
-rw-r--r-- | content/2022-07-07-llvm-orc-jit/CMakeLists.txt | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/content/2022-07-07-llvm-orc-jit/CMakeLists.txt b/content/2022-07-07-llvm-orc-jit/CMakeLists.txt new file mode 100644 index 0000000..04fe617 --- /dev/null +++ b/content/2022-07-07-llvm-orc-jit/CMakeLists.txt @@ -0,0 +1,30 @@ +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() |