aboutsummaryrefslogtreecommitdiffhomepage
path: root/content/2022-07-07-llvm-orc-jit/CMakeLists.txt
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2023-12-19 18:53:31 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2023-12-19 18:54:35 +0100
commita599959a61e2a9ae313b851b2b63c0a2b97d3cb5 (patch)
treece0b3346b48df0926560c305394ff04b86fcccb3 /content/2022-07-07-llvm-orc-jit/CMakeLists.txt
parent34fe7e1b93f73dc8ffb42cc172f4a9966453faa9 (diff)
downloadblog-a599959a61e2a9ae313b851b2b63c0a2b97d3cb5.tar.gz
blog-a599959a61e2a9ae313b851b2b63c0a2b97d3cb5.zip
llvm-orc-jit: migrate to llvm17
Diffstat (limited to 'content/2022-07-07-llvm-orc-jit/CMakeLists.txt')
-rw-r--r--content/2022-07-07-llvm-orc-jit/CMakeLists.txt30
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()