-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathCMakeLists.txt
executable file
·110 lines (87 loc) · 4.17 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
project( GKLEE )
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
set ( GKLEE_VERSION_MAJOR 0)
set ( GKLEE_VERSION_MINOR 1)
set( CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR} )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin )
# -----------------------------------------------------------------------------
# Make RelWithDebInfo the default build type if otherwise not set
# -----------------------------------------------------------------------------
set(build_types Debug Release RelWithDebInfo MinSizeRel)
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "You can choose the type of build, options are:${build_types}")
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE String
"Options are ${build_types}"
FORCE
)
# Provide drop down menu options in cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${build_types})
endif()
message(STATUS "Doing a ${CMAKE_BUILD_TYPE} build")
if( DO_GLIBCXX_DEBUG )
set( GLIBCXX -DGLIBCXX_DEBUG )
endif()
# Search paths for custom CMake modules
set( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
#set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH};${LLVM_SRC}/src/LLVM/cmake/modules )
#does system check for basic capabilities (for settings in config.h.in, including e.g. PACKAGE_BUGREPORT)
include( ${CMAKE_MODULE_PATH}/Introspect.cmake )
CONFIGURE_FILE( Gklee/include/klee/Config/config.h.in Gklee/include/klee/Config/config.h )
find_package(Doxygen)
if(DOXYGEN_FOUND)
message( "Found Doxygen" )
CONFIGURE_FILE( doc/Doxyfile.in doc/Doxyfile )
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/doc/Doxyfile
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/doc
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
else()
message( "No Doxygen found" )
endif(DOXYGEN_FOUND)
#installs external projects -- stp and llvm
MESSAGE( "loading SetupExterns.cmake" )
include( ${CMAKE_MODULE_PATH}/SetupExterns.cmake )
message( "CMAKE_MODULE_PATH is ${CMAKE_MODULE_PATH}" )
# -----------------------------------------------------------------------------
# Set the appropriate build flags
# -----------------------------------------------------------------------------
include( ${CMAKE_MODULE_PATH}/CompilerFlags.cmake )
# -----------------------------------------------------------------------------
# Option to enable/disable assertions
# -----------------------------------------------------------------------------
# Filter out definition of NDEBUG from the default build configuration flags.
# We will add this ourselves if we want to disable assertions
foreach (build_config ${build_types})
string(TOUPPER ${build_config} upper_case_build_config)
foreach (language CXX C)
set(VAR_TO_MODIFY "CMAKE_${language}_FLAGS_${upper_case_build_config}")
string(REGEX REPLACE "(^| )[/-]D *NDEBUG($| )"
" "
replacement
"${${VAR_TO_MODIFY}}"
)
#message("Original (${VAR_TO_MODIFY}) is ${${VAR_TO_MODIFY}} replacement is ${replacement}")
set(${VAR_TO_MODIFY} "${replacement}" CACHE STRING "Default flags for ${build_config} configuration" FORCE)
endforeach()
endforeach()
option(ENABLE_ASSERTIONS "Build with assertions enabled" ON)
if (ENABLE_ASSERTIONS)
# NDEBUG was already removed.
else()
# Note this definition doesn't appear in the cache variables.
add_definitions( "-DNDEBUG" )
endif()
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
add_subdirectory(Gklee)
# add_custom_command( TARGET ./compile_commands.json POST_BUILD
# COMMAND file( READ ../llvm/src/LLVM-build/compile_commands.json CC.json )
# COMMAND file( APPEND ./compile_commands.json ${CC.json} )
# COMMAND file( READ ../llvm/projects/TaintAnalysis/src/TaintAnalysis-build/compile_commands.json CC.json )
# COMMAND file( APPEND ./compile_commands.json ${CC.json} )
# COMMAND file( READ ../Gklee/STP/src/STP-build/compile_commands.json CC.json )
# COMMAND file( APPEND ./compile_commands.json ${CC.json} )
# )