-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
CMakeLists.txt
69 lines (51 loc) · 1.84 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
# Modern CMake
cmake_minimum_required(VERSION 3.18)
project(VTIL-Utils)
# Visual Studio generator specific flags
if (CMAKE_GENERATOR MATCHES "Visual Studio")
# HACK: DO NOT this to add compiler flags/definitions, use target_compile_options on a
# target instead https://cmake.org/cmake/help/latest/command/target_compile_options.html
# Enable multiprocessor compilation
add_compile_options(/MP)
endif()
# Add module path for dependencies
list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# Enable solution folder support
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Workaround for https://github.com/cpm-cmake/CPM.cmake/issues/281
set(CPM_SOURCE_CACHE OFF CACHE BOOL "" FORCE)
# Hack for working Debug configuration
add_definitions(-DVTIL_SYMEX_VERIFY=0)
# Dependency packages
set(CMAKE_FOLDER "Dependencies")
include(CPM)
include(VTIL-Core)
include(VTIL-NativeLifters)
include(args)
include(asmjit)
# Target to generate third_party.txt
set(DEPENDENCY_PACKAGES "${CPM_PACKAGES}")
include(CPMLicenses)
cpm_licenses_create_disclaimer_target(
write-licenses "${CMAKE_CURRENT_BINARY_DIR}/third_party.txt" "${DEPENDENCY_PACKAGES}"
)
set(CMAKE_FOLDER "")
# Project target
file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS src/*.cpp src/*.hpp include/*.hpp)
add_executable(${PROJECT_NAME}
${SOURCES}
)
source_group(TREE ${PROJECT_SOURCE_DIR} FILES ${SOURCES})
target_link_libraries(${PROJECT_NAME} PRIVATE
NativeLifters-Core
args
asmjit::asmjit
)
target_include_directories(${PROJECT_NAME} PRIVATE include)
set_target_properties(${PROJECT_NAME} PROPERTIES
OUTPUT_NAME vtil
)
# Set Visual Studio startup project
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME})
# Installation
install(TARGETS ${PROJECT_NAME})