libfstools: ubi: rework reading volumes
[project/fstools.git] / CMakeLists.txt
index c1e5a09..ba375f2 100644 (file)
@@ -33,13 +33,27 @@ ADD_LIBRARY(ubi-utils STATIC
                libubi/libubi.c
                libubi/libubi-tiny.c
                libubi/ubiutils-common.c)
+INSTALL(TARGETS ubi-utils ARCHIVE DESTINATION lib)
+
+SET_TARGET_PROPERTIES(ubi-utils PROPERTIES COMPILE_FLAGS
+               "-ffunction-sections -fdata-sections")
+
+INSTALL(FILES libubi/libubi-tiny.h libubi/libubi.h libubi/ubi-media.h
+               libubi/ubi-user.h libubi/ubi-media.h
+       DESTINATION include
+)
 
 ADD_EXECUTABLE(mount_root mount_root.c)
 TARGET_LINK_LIBRARIES(mount_root fstools)
 INSTALL(TARGETS mount_root RUNTIME DESTINATION sbin)
 
 ADD_EXECUTABLE(block block.c)
-TARGET_LINK_LIBRARIES(block blkid-tiny uci ubox blobmsg_json)
+IF(DEFINED CMAKE_UBIFS_EXTROOT)
+       ADD_DEFINITIONS(-DUBIFS_EXTROOT)
+       TARGET_LINK_LIBRARIES(block blkid-tiny uci ubox blobmsg_json ubi-utils)
+ELSE(DEFINED CMAKE_UBIFS_EXTROOT)
+       TARGET_LINK_LIBRARIES(block blkid-tiny uci ubox blobmsg_json)
+ENDIF(DEFINED CMAKE_UBIFS_EXTROOT)
 INSTALL(TARGETS block RUNTIME DESTINATION sbin)
 
 ADD_EXECUTABLE(jffs2reset jffs2reset.c)