-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
70 lines (56 loc) · 1.6 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
cmake_minimum_required(VERSION 3.13)
project(sqlgen)
set(CMAKE_CXX_STANDARD 14)
find_package(LLVM REQUIRED CONFIG)
message(STATUS "Using LLVM ${LLVM_PACKAGE_VERSION}")
add_definitions(${LLVM_DEFINITIONS})
include_directories(${LLVM_INCLUDE_DIRS})
link_directories(${LLVM_LIBRARY_DIR})
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
include(AddLLVM)
# Handle RTTI stuff, which often leads to error
if(NOT ${LLVM_ENABLE_RTTI})
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
message(STATUS "Disable RTTI")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
message(STATUS "Disable RTTI")
endif()
# Do not give any flags for other less widely used
# compilers
endif()
set(_SOURCE_FILES
Error.cpp
sqlgen.cpp
SQLEmitter.cpp
SQLInsertEmitter.cpp
SQLQueryEmitter.cpp
SQLTableEmitter.cpp
)
set(LLVM_LINK_COMPONENTS
Support
TableGen
)
add_llvm_executable(sqlgen
${_SOURCE_FILES})
set(FILECHECK_PATH "" CACHE FILEPATH "Path to FileCheck.")
if (NOT FILECHECK_PATH)
# Try to find FileCheck from LLVM first
find_program(FILECHECK_EXE
FileCheck
NO_CACHE)
if (NOT FILECHECK_EXE)
# Then try to find the python version, filecheck
find_program(FILECHECK_EXE
filecheck
NO_CACHE)
endif()
if (FILECHECK_EXE)
message(STATUS "Using ${FILECHECK_EXE}")
set(FILECHECK_PATH ${FILECHECK_EXE})
endif()
endif()
add_subdirectory(test)