forked from dyninst/dyninst
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
119 lines (96 loc) · 3.06 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
cmake_minimum_required(VERSION 3.4.0)
# There is a bug in 3.19.0 that causes .S files to be treated like C files
if(CMAKE_VERSION VERSION_EQUAL "3.19.0")
message(FATAL_ERROR "Dyninst cannot use CMake version 3.19.0")
endif()
project(Dyninst)
set(DYNINST_ROOT ${PROJECT_SOURCE_DIR})
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(STERILE_BUILD
ON
CACHE BOOL "Do not download/build any third-party dependencies from source")
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib"
isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
endif()
set(CMAKE_MODULE_PATH "${DYNINST_ROOT}/cmake" "${DYNINST_ROOT}/cmake/Modules"
${CMAKE_MODULE_PATH})
# Set the C and C++ language standards
include(LanguageStandards)
# Find the necessary third-party libraries
find_package(ThreadDB)
find_package(Threads)
include(Boost)
include(ThreadingBuildingBlocks)
include(ElfUtils)
if(UNIX)
include(LibIberty REQUIRED)
endif()
include(shared)
if(USE_OpenMP)
find_package(OpenMP REQUIRED)
endif()
configure_file(cmake/version.h.in common/h/dyninstversion.h)
include_directories(${PROJECT_BINARY_DIR})
include_directories(${PROJECT_BINARY_DIR}/common/h)
set(HEADER_DIRS
common
dataflowAPI
dyninstAPI
instructionAPI
parseAPI
patchAPI
proccontrol
stackwalk
symtabAPI)
if(NOT ${PLATFORM} MATCHES nt)
set(HEADER_DIRS ${HEADER_DIRS} dwarf elf symlite)
endif()
foreach(dir ${HEADER_DIRS})
include_directories(${DYNINST_ROOT}/${dir}/h)
endforeach()
set(ADD_VALGRIND_ANNOTATIONS
OFF
CACHE BOOL "Enable annotations for Valgrind analysis")
if(ADD_VALGRIND_ANNOTATIONS)
find_package(Valgrind REQUIRED)
include_directories(${Valgrind_INCLUDE_DIRS})
add_definitions(-DENABLE_VG_ANNOTATIONS)
endif()
include_directories(${DYNINST_ROOT} ${DYNINST_ROOT}/external ${TBB_INCLUDE_DIRS})
# Component time
add_subdirectory(common)
if(NOT ${PLATFORM} MATCHES nt)
add_subdirectory(elf)
add_subdirectory(dwarf)
add_subdirectory(symlite)
endif()
add_subdirectory(instructionAPI)
add_subdirectory(symtabAPI)
add_subdirectory(parseAPI)
add_subdirectory(proccontrol)
add_subdirectory(stackwalk)
add_subdirectory(patchAPI)
if(${SYMREADER} MATCHES symtabAPI)
add_subdirectory(dyninstAPI)
add_subdirectory(dynC_API)
add_subdirectory(parseThat)
endif()
add_subdirectory(dyninstAPI_RT)
set(ENABLE_STATIC_LIBS
NO
CACHE STRING "Build static libraries as well?")
set(VERSION_STRING
"${DYNINST_MAJOR_VERSION}.${DYNINST_MINOR_VERSION}.${DYNINST_PATCH_VERSION}")
set(DYNINST_NAME "DyninstAPI-${VERSION_STRING}")
if(TARGET boost)
add_dependencies(common boost)
endif()
# add_subdirectory(testsuite)
# Copy out all of the cmake files so they can be used by the Testsuite
install(DIRECTORY ${DYNINST_ROOT}/cmake/ DESTINATION ${INSTALL_CMAKE_DIR})
install(FILES ${PROJECT_BINARY_DIR}/CMakeCache.txt DESTINATION ${INSTALL_CMAKE_DIR})