-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
63 lines (49 loc) · 1.4 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
cmake_minimum_required(VERSION 2.6)
PROJECT(opkg C)
INCLUDE(TestBigEndian)
SET(HOST_CPU "" CACHE STRING "Override Host CPU")
SET(BUILD_CPU "" CACHE STRING "Override Host CPU")
SET(LOCK_FILE "/var/lock/opkg.lock" CACHE STRING "Override lock file path")
SET(PATH_SPEC "/usr/sbin:/usr/bin:/sbin:/bin" CACHE STRING "Override default PATH value")
SET(VERSION "" CACHE STRING "Override version")
OPTION(STATIC_UBOX "Statically link libubox" OFF)
OPTION(BUILD_TESTS "Build test programs" ON)
OPTION(ENABLE_USIGN "Enable usign support" ON)
IF(NOT HOST_CPU)
SET(HOST_CPU "${CMAKE_HOST_SYSTEM_PROCESSOR}")
ENDIF()
IF(NOT BUILD_CPU)
SET(BUILD_CPU "${CMAKE_SYSTEM_PROCESSOR}")
ENDIF()
IF(NOT VERSION)
EXECUTE_PROCESS(COMMAND git log -1 "--format=%h (%ci)"
OUTPUT_VARIABLE VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
ENDIF()
IF(NOT VERSION)
SET(VERSION "unknown")
ENDIF()
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
ADD_DEFINITIONS(-Os -Wall --std=gnu99 -g3 -Wmissing-declarations
-DDATADIR="/usr/share"
-DOPKGETCDIR="/etc"
-DOPKGLOCKFILE="${LOCK_FILE}"
-DOPKGLIBDIR="/usr/lib"
-DHOST_CPU_STR="${HOST_CPU}"
-DBUILD_CPU=${BUILD_CPU}
-DPATH_SPEC="${PATH_SPEC}"
-DVERSION="${VERSION}"
)
IF(ENABLE_USIGN)
ADD_DEFINITIONS(-DHAVE_USIGN)
ENDIF()
IF(WORDS_BIGENDIAN)
ADD_DEFINITIONS(-DWORDS_BIGENDIAN)
ENDIF()
ADD_SUBDIRECTORY(libbb)
ADD_SUBDIRECTORY(libopkg)
ADD_SUBDIRECTORY(src)
IF(BUILD_TESTS)
ADD_SUBDIRECTORY(tests)
ENDIF()