-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
70 lines (56 loc) · 1.92 KB
/
Copy pathCMakeLists.txt
File metadata and controls
70 lines (56 loc) · 1.92 KB
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
cmake_minimum_required(VERSION 3.20)
project(redasm-workspace C CXX)
if(WIN32)
set(CMAKE_INSTALL_BINDIR ".")
set(CMAKE_INSTALL_LIBDIR ".")
set(CMAKE_INSTALL_DATADIR ".")
set(CMAKE_INSTALL_INCLUDEDIR "include")
set(REDASM_INSTALL_PLUGINS "plugins/${type}")
set(REDASM_INSTALL_KB "kb")
else()
include(GNUInstallDirs)
set(REDASM_INSTALL_PLUGINS "${CMAKE_INSTALL_LIBDIR}/redasm/plugins")
set(REDASM_INSTALL_KB "${CMAKE_INSTALL_DATADIR}/redasm/kb")
endif()
add_subdirectory(core)
add_subdirectory(redasm)
add_subdirectory(loaders)
add_subdirectory(processors)
add_subdirectory(analyzers)
add_subdirectory(commands)
add_subdirectory(kb)
if(REDASM_SAMPLES)
enable_testing()
add_subdirectory(tests)
endif()
macro(redasm_stage target dest)
add_custom_target(stage_${target} ALL
COMMAND ${CMAKE_COMMAND} -E make_directory "${dest}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:${target}>" "${dest}/"
COMMENT "Staging ${target} -> ${dest}"
DEPENDS ${target}
)
endmacro()
redasm_stage(redasm "$<TARGET_FILE_DIR:redasm-gui>")
set(REDASM_PLUGIN_TYPES
loaders
processors
analyzers
commands
)
foreach(type ${REDASM_PLUGIN_TYPES})
get_property(subdirs DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${type}" PROPERTY SUBDIRECTORIES)
foreach(subdir ${subdirs})
get_property(targets DIRECTORY ${subdir} PROPERTY BUILDSYSTEM_TARGETS)
foreach(target ${targets})
get_target_property(target_type ${target} TYPE)
if(target_type STREQUAL "SHARED_LIBRARY")
redasm_stage(${target} "$<TARGET_FILE_DIR:redasm-gui>/plugins/${type}")
endif()
endforeach()
endforeach()
endforeach()
add_custom_target(stage_kb ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/kb" "$<TARGET_FILE_DIR:redasm-gui>/kb"
COMMENT "Staging kb -> $<TARGET_FILE_DIR:redasm-gui>/kb/"
)