forked from dyninst/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
85 lines (75 loc) · 2.37 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
cmake_minimum_required(VERSION 3.13.0)
project(examples)
# User must provide location of Dyninst cmake files either as a cache or
# environment variable
if(NOT Dyninst_DIR)
if("$ENV{Dyninst_DIR}" STREQUAL "")
message(
FATAL_ERROR
"Dyninst_DIR not found: define as a cache or environment variable")
else()
set(_dyninst_dir $ENV{Dyninst_DIR})
endif()
else()
set(_dyninst_dir ${Dyninst_DIR})
set($ENV{Dyninst_DIR} ${_dyninst_dir})
endif()
# Make sure it's an absolute path
if(NOT IS_ABSOLUTE ${_dyninst_dir})
get_filename_component(_tmp ${_dyninst_dir} ABSOLUTE)
set(_dyninst_dir ${_tmp})
unset(_tmp)
endif()
# Save the munged path in the global name
set(Dyninst_DIR ${_dyninst_dir})
unset(_dyninst_dir)
# Use the Dyninst-provided CMake modules
set(CMAKE_MODULE_PATH
"${Dyninst_DIR}"
"${Dyninst_DIR}/Modules"
${CMAKE_MODULE_PATH})
# Import the Dyninst components
find_package(Dyninst REQUIRED
COMPONENTS common
dyninstAPI
instructionAPI
parseAPI
symtabAPI
common)
# Read the cache generated from building Dyninst
load_cache(${Dyninst_DIR}
READ_WITH_PREFIX DYNINST_
Boost_LIBRARIES
Boost_INCLUDE_DIRS
Boost_LIBRARY_DIRS
Boost_DEFINES
TBB_INCLUDE_DIRS)
# Set default configuration type
if(NOT CMAKE_BUILD_TYPE)
set(
CMAKE_BUILD_TYPE RelWithDebInfo
CACHE
STRING
"Choose the build type (None, Debug, Release, RelWithDebInfo, MinSizeRel)"
FORCE)
endif()
# Set the C and C++ language API and ABI standards
include(LanguageStandards)
# Use the same optimization settings used to build Dyninst
include(optimization)
# ----------------------------------------------------------------------------#
# Set up the individual examples
get_filename_component(EXAMPLE_ROOT ${CMAKE_CURRENT_SOURCE_DIR} ABSOLUTE)
add_executable(InterestingProgram common/mutatees/InterestingProgram.cpp)
add_subdirectory(codeCoverage)
add_subdirectory(unstrip)
add_subdirectory(instrumentAFunction)
add_subdirectory(memoryAccessCounter)
add_subdirectory(instrumentMemoryAccess)
add_subdirectory(interceptOutput)
add_subdirectory(maxMallocSize)
add_subdirectory(disassemble)
add_subdirectory(CFGraph)
add_subdirectory(DynC)
add_subdirectory(unusedArgs)
add_subdirectory(tracetool)