-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
92 lines (75 loc) · 2.49 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
cmake_minimum_required(VERSION 3.15)
project (noseatbelt)
if(CMAKE_BUILD_TYPE STREQUAL "Release")
message("")
message(" //")
message(" //")
message(" Release Build \\\\//")
message(" \\/")
message(" ")
else()
message("")
message(" ===================")
message(" !!! DEBUG BUILD !!!")
message(" ===================")
message("")
endif()
file(GLOB noseatbelt_SRC CONFIGURE_DEPENDS "src/noseatbelt/*.c")
file(GLOB preload_SRC CONFIGURE_DEPENDS "src/preload/*.c")
file(GLOB auto_SRC CONFIGURE_DEPENDS "src/auto-dll/*.c")
file(GLOB example_SRC CONFIGURE_DEPENDS "src/example/*.c")
if (UNIX)
add_compile_definitions(UNIX)
elseif (WIN32)
add_compile_definitions(WIN32)
endif ()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
option(ZYDIS_BUILD_TOOLS "" OFF)
option(ZYDIS_BUILD_EXAMPLES "" OFF)
if(CMAKE_BUILD_TYPE STREQUAL "Release")
option(ZYDIS_FEATURE_FORMATTER "" OFF)
else()
option(ZYDIS_FEATURE_FORMATTER "" ON)
endif()
option(ZYDIS_BUILD_SHARED_LIB "" ON)
add_subdirectory(dependencies/zydis)
include_directories(
./include
./dependencies/zydis/include
./dependencies/zydis/dependencies/zycore/include
${CMAKE_BINARY_DIR}/dependencies/zydis
${CMAKE_BINARY_DIR}/dependencies/zydis/zycore)
add_library(noseatbelt SHARED ${noseatbelt_SRC})
if (UNIX)
target_link_libraries(noseatbelt PRIVATE Zydis)
elseif (WIN32)
target_link_libraries(noseatbelt PRIVATE Zydis Dbghelp)
endif ()
if (UNIX)
add_library(noseatbelt-auto SHARED ${preload_SRC})
target_link_libraries(noseatbelt-auto PRIVATE noseatbelt dl)
set_property(TARGET noseatbelt-auto PROPERTY POSITION_INDEPENDENT_CODE ON)
endif (UNIX)
if (WIN32)
add_library(noseatbelt-auto SHARED ${auto_SRC})
set_target_properties(noseatbelt-auto PROPERTIES SUFFIX ".asi")
target_link_libraries(noseatbelt-auto PRIVATE noseatbelt)
set_property(TARGET noseatbelt-auto PROPERTY POSITION_INDEPENDENT_CODE ON)
endif (WIN32)
# On Windows we only use the current compiler
if (UNIX)
add_subdirectory(examples/gcc)
add_subdirectory(examples/clang)
else()
if (CMAKE_C_COMPILER_ID MATCHES "Clang")
add_subdirectory(examples/clang)
endif()
if (CMAKE_C_COMPILER_ID MATCHES "GNU")
add_subdirectory(examples/gcc)
endif()
if (CMAKE_C_COMPILER_ID MATCHES "MSVC")
add_subdirectory(examples/msvc)
endif()
endif ()