1 cmake_minimum_required(VERSION 2.6)
4 ADD_DEFINITIONS(-Os -ggdb -Wall -Werror --std=gnu99 -Wmissing-declarations)
6 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
8 ADD_LIBRARY(fstools SHARED
18 TARGET_LINK_LIBRARIES(fstools ubox)
19 INSTALL(TARGETS fstools LIBRARY DESTINATION lib)
21 ADD_LIBRARY(blkid-tiny SHARED
22 libblkid-tiny/libblkid-tiny.c
30 libblkid-tiny/squashfs.c
34 INSTALL(TARGETS blkid-tiny LIBRARY DESTINATION lib)
36 ADD_LIBRARY(ubi-utils STATIC
39 libubi/ubiutils-common.c)
40 INSTALL(TARGETS ubi-utils ARCHIVE DESTINATION lib)
42 SET_TARGET_PROPERTIES(ubi-utils PROPERTIES COMPILE_FLAGS
43 "-ffunction-sections -fdata-sections")
45 INSTALL(FILES libubi/libubi-tiny.h libubi/libubi.h libubi/ubi-media.h
46 libubi/ubi-user.h libubi/ubi-media.h
50 ADD_EXECUTABLE(mount_root mount_root.c)
51 TARGET_LINK_LIBRARIES(mount_root fstools)
52 INSTALL(TARGETS mount_root RUNTIME DESTINATION sbin)
54 ADD_EXECUTABLE(block block.c)
55 IF(DEFINED CMAKE_UBIFS_EXTROOT)
56 ADD_DEFINITIONS(-DUBIFS_EXTROOT)
57 TARGET_LINK_LIBRARIES(block blkid-tiny uci ubox blobmsg_json ubi-utils)
58 ELSE(DEFINED CMAKE_UBIFS_EXTROOT)
59 TARGET_LINK_LIBRARIES(block blkid-tiny uci ubox blobmsg_json)
60 ENDIF(DEFINED CMAKE_UBIFS_EXTROOT)
61 INSTALL(TARGETS block RUNTIME DESTINATION sbin)
63 ADD_EXECUTABLE(jffs2reset jffs2reset.c)
64 TARGET_LINK_LIBRARIES(jffs2reset fstools)
65 INSTALL(TARGETS jffs2reset RUNTIME DESTINATION sbin)
67 ADD_EXECUTABLE(snapshot_tool snapshot.c)
68 TARGET_LINK_LIBRARIES(snapshot_tool fstools)
69 INSTALL(TARGETS snapshot_tool RUNTIME DESTINATION sbin)
71 ADD_EXECUTABLE(ubi ubi.c)
72 TARGET_LINK_LIBRARIES(ubi ubi-utils ubox)
73 INSTALL(TARGETS ubi RUNTIME DESTINATION sbin)