-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
36 lines (30 loc) · 1.11 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
cmake_minimum_required(VERSION 3.14)
project (dropbear C)
include(FetchContent)
FetchContent_Declare(
dropbear
GIT_REPOSITORY "https://github.com/mkj/dropbear.git"
GIT_TAG "DROPBEAR_2022.83"
SOURCE_DIR "src"
BINARY_DIR "out"
)
FetchContent_MakeAvailable(dropbear)
execute_process(
# GCC 4.9 bug, both stddef.h stdlib.h define NULL without inclusion guards.
COMMAND sed -i "s@#include <stddef.h>@//#include <stddef.h>@g" ${dropbear_SOURCE_DIR}/libtommath/tommath.h
COMMAND ./configure --host=${TARGET_PLATFORM} --disable-zlib --enable-static
WORKING_DIRECTORY ${dropbear_SOURCE_DIR}
)
add_custom_command(
OUTPUT dropbear_build
COMMAND cd ${dropbear_SOURCE_DIR} && make PROGRAMS='dropbear dbclient dropbearkey dropbearconvert scp' MULTI=1 SCPPROGRESS=1
COMMAND cp ${dropbear_SOURCE_DIR}/dropbearmulti ${dropbear_BINARY_DIR}
)
add_custom_command(
OUTPUT dropbear_cleanall
COMMAND find . -name '*.o' -delete
COMMAND find . -name '*.a' -delete
COMMAND rm -rf ${dropbear_BINARY_DIR}/*
)
add_custom_target(dropbearmulti ALL DEPENDS dropbear_build)
add_custom_target(dropbear_clean DEPENDS dropbear_cleanall)