forked from OmniBlade/unassemblize
-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
81 lines (66 loc) · 2.03 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
cmake_minimum_required(VERSION 3.16)
# Use packagename_ROOT for FindPackage.
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
# Disable default MSVC warning level so we can set it ourselves.
if(POLICY CMP0092)
cmake_policy(SET CMP0092 NEW)
endif()
# Disable default MSVC runtime hardcoding.
if(POLICY CMP0091)
cmake_policy(SET CMP0091 NEW)
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
project(unassemblize LANGUAGES C CXX)
# Set up a format target to do automated clang format checking.
find_package(ClangFormat)
include(ClangFormat)
if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows")
set(WINDOWS TRUE)
endif()
include(FetchContent)
FetchContent_Declare(
zydis
GIT_REPOSITORY https://github.com/zyantific/zydis.git
GIT_TAG 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
)
set(ZYDIS_BUILD_EXAMPLES OFF)
set(ZYDIS_FEATURE_ENCODER OFF)
FetchContent_MakeAvailable(zydis)
FetchContent_Declare(
lief
GIT_REPOSITORY https://github.com/lief-project/LIEF.git
GIT_TAG 2d9855fc7f9d4ce6325245f8b75c98eb7663db60
)
set(LEIF_EXAMPLES OFF)
set(LEIF_INSTALL OFF)
set(LIEF_C_API OFF)
set(LIEF_PYTHON_API OFF)
set(LIEF_TESTS OFF)
FetchContent_MakeAvailable(lief)
FetchContent_Declare(
json
GIT_REPOSITORY https://github.com/nlohmann/json.git
GIT_TAG bc889afb4c5bf1c0d8ee29ef35eaaf4c8bef8a5d
)
FetchContent_MakeAvailable(json)
set(GIT_PRE_CONFIGURE_FILE "gitinfo.cpp.in")
set(GIT_POST_CONFIGURE_FILE "${CMAKE_CURRENT_BINARY_DIR}/gitinfo.cpp")
include(GitWatcher)
add_executable(unassemblize)
target_sources(unassemblize PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/gitinfo.cpp
gitinfo.h
executable.cpp
executable.h
function.cpp
function.h
main.cpp
)
target_link_libraries(unassemblize PRIVATE Zydis LIEF::LIEF nlohmann_json)
target_include_directories(unassemblize PRIVATE .)
if(WINDOWS)
target_sources(unassemblize PRIVATE wincompat/getopt.c wincompat/getopt.h wincompat/strings.h)
target_include_directories(unassemblize PRIVATE wincompat)
endif()