-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
50 lines (42 loc) · 1.32 KB
/
CMakeLists.txt
File metadata and controls
50 lines (42 loc) · 1.32 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
# setup project
cmake_minimum_required(VERSION 3.9)
project(memflow-cmake-example VERSION 1.0 DESCRIPTION "memflow-cmake-example")
# load memflow project
include(ExternalProject)
set_directory_properties(PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/rs)
ExternalProject_Add(
memflow
GIT_REPOSITORY "https://github.com/memflow/memflow"
GIT_SHALLOW true
GIT_PROGRESS true
GIT_TAG "0.2.3"
CONFIGURE_COMMAND ""
BUILD_COMMAND cargo build --all-features --workspace
COMMAND cargo build --release --all-features --workspace
BINARY_DIR "${CMAKE_BINARY_DIR}/rs/src/memflow"
INSTALL_COMMAND ""
LOG_BUILD ON)
find_package(Threads)
# create binary from /src
file(GLOB_RECURSE sample-cpp-sources "src/*.cpp")
file(GLOB_RECURSE sample-sources "src/*.c")
file(GLOB_RECURSE sample-headers "src/*.h")
set(CMAKE_CXX_STANDARD 11)
add_executable(
example
${sample-sources}
${sample-cpp-sources}
${sample-headers})
add_dependencies(
example
memflow)
target_link_libraries(
example
debug "${CMAKE_BINARY_DIR}/rs/src/memflow/target/debug/libmemflow_ffi.a"
optimized "${CMAKE_BINARY_DIR}/rs/src/memflow/target/release/libmemflow_ffi.a"
${CMAKE_THREAD_LIBS_INIT}
${CMAKE_DL_LIBS}
m)
target_include_directories(
example PUBLIC
"${CMAKE_BINARY_DIR}/rs/src/memflow/memflow-ffi")