-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
36 lines (31 loc) · 2.02 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
cmake_minimum_required(VERSION 2.8)
project(canary C CXX)
if(NOT LLVM_BUILD_PATH)
find_package(LLVM REQUIRED CONFIG)
else ()
find_package(LLVM REQUIRED CONFIG PATHS "${LLVM_BUILD_PATH}/share/llvm/cmake/" NO_DEFAULT_PATH)
# set (LLVMCONFIG "${LLVM_BUILD_PATH}/bin/llvm-config")
#find_program(LLVMCONFIG llvm-config PATHS ${LLVM_BUILD_PATH}/bin ${LLVM_BUILD_PATH}/Debug/bin ${LLVM_BUILD_PATH}/Release/bin)
# execute_process(COMMAND ${LLVMCONFIG} --cxxflags OUTPUT_VARIABLE CMAKE_CXX_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
# execute_process(COMMAND ${LLVMCONFIG} --cflags OUTPUT_VARIABLE CMAKE_C_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
# execute_process(COMMAND ${LLVMCONFIG} --cppflags OUTPUT_VARIABLE CMAKE_CPP_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
# execute_process(COMMAND ${LLVMCONFIG} --ldflags OUTPUT_VARIABLE CMAKE_EXE_LINKER_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
# execute_process(COMMAND ${LLVMCONFIG} --libdir OUTPUT_VARIABLE LIB_PATHS OUTPUT_STRIP_TRAILING_WHITESPACE)
# execute_process(COMMAND ${LLVMCONFIG} --system-libs OUTPUT_VARIABLE LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
# execute_process(COMMAND ${LLVMCONFIG} --includedir OUTPUT_VARIABLE LLVM_INCLUDE_DIRS OUTPUT_STRIP_TRAILING_WHITESPACE)
#
# set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LIB_PATHS} ${LIBS}")
# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
# set (INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include ${LLVM_INCLUDE_DIRS})
# include_directories (${CMAKE_SOURCE_DIR}/include ${LLVM_INCLUDE_DIRS})
# set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
endif()
include_directories (${CMAKE_SOURCE_DIR}/include ${LLVM_INCLUDE_DIRS})
message(STATUS "LLVM version: ${LLVM_VERSION}")
add_subdirectory(lib)
add_subdirectory(tools)
if (ENABLE_ASAN)
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
endif()