forked from esbmc/esbmc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
131 lines (108 loc) · 3.75 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#################################
# Project Information #
#################################
cmake_minimum_required (VERSION 3.7)
project (ESBMC)
set (ESBMC_VERSION_MAJOR 7)
set (ESBMC_VERSION_MINOR 0)
set (ESBMC_VERSION_PATCH 0)
set (ESBMC_VERSION "${ESBMC_VERSION_MAJOR}.${ESBMC_VERSION_MINOR}.${ESBMC_VERSION_PATCH}")
# The only default solver available is smtlib
set (ESBMC_AVAILABLE_SOLVERS "smtlib")
#################################
# Configuration #
#################################
# Adds custom modules from ESBMC and default Options
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/scripts/cmake/")
# Set a default build type if none was specified
set(default_build_type "RelWithDebInfo")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo" "Sanitizer")
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
add_compile_options(-Wall -Wextra)
endif()
include(CheckIncludeFile)
check_include_file(unistd.h HAVE_UNISTD)
include(Utils)
include(OSConfiguration)
include(Options)
include(SendFileHack)
include(AppleConfiguration)
include(InstallFiles)
include(Sanitizers)
include(ClangTidy)
include(Coverage)
if(BUILD_STATIC)
include(BuildStatic)
endif()
include(ExternalDependencies)
# Copied from https://stackoverflow.com/questions/53877344/cannot-configure-cmake-to-look-for-homebrew-installed-version-of-bison
# On macOS, search Homebrew for keg-only versions of Bison and Flex. Xcode does
# not provide new enough versions for us to use.
if (CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin")
execute_process(
COMMAND brew --prefix bison
RESULT_VARIABLE BREW_BISON
OUTPUT_VARIABLE BREW_BISON_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (BREW_BISON EQUAL 0 AND EXISTS "${BREW_BISON_PREFIX}")
message(STATUS "Found Bison keg installed by Homebrew at ${BREW_BISON_PREFIX}")
set(BISON_EXECUTABLE "${BREW_BISON_PREFIX}/bin/bison")
endif()
execute_process(
COMMAND brew --prefix flex
RESULT_VARIABLE BREW_FLEX
OUTPUT_VARIABLE BREW_FLEX_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (BREW_FLEX EQUAL 0 AND EXISTS "${BREW_FLEX_PREFIX}")
message(STATUS "Found Flex keg installed by Homebrew at ${BREW_FLEX_PREFIX}")
set(FLEX_EXECUTABLE "${BREW_FLEX_PREFIX}/bin/flex")
endif()
endif()
find_package(BISON 2.6.1 REQUIRED)
find_package(FLEX 2.6.1 REQUIRED)
# This MUST be executed after BuildStatic since it sets Boost Static flags
find_package(Boost REQUIRED COMPONENTS filesystem system date_time program_options iostreams)
include(FindLLVM)
# Optimization
include(OptimizationCCache)
include(WError)
if(ENABLE_OLD_FRONTEND)
add_definitions(-DENABLE_OLD_FRONTEND)
endif()
if(ENABLE_SOLIDITY_FRONTEND)
add_definitions(-DENABLE_SOLIDITY_FRONTEND)
endif()
if(ENABLE_JIMPLE_FRONTEND)
add_definitions(-DENABLE_JIMPLE_FRONTEND)
endif()
if(ENABLE_GOTO_CONTRACTOR)
add_compile_options(-DENABLE_GOTO_CONTRACTOR)
endif()
add_subdirectory(src)
include(Irep2Optimization)
# Generate ac_config.h. This must be generated after solvers
configure_file (
"${PROJECT_SOURCE_DIR}/scripts/cmake/cmake_config.in"
"${PROJECT_BINARY_DIR}/src/ac_config.h"
)
# This should be added after all source files
include(Docs)
include(CTest)
if(BUILD_TESTING)
enable_testing()
include_directories(src)
add_subdirectory(unit)
endif()
if(ENABLE_REGRESSION)
add_subdirectory(regression)
endif()
include(FindCsmith)