set LD_LIBRARY_PATH when invoking block extroot from temporary overlay
[project/fstools.git] / CMakeLists.txt
index b81d66c..8234b44 100644 (file)
@@ -5,19 +5,18 @@ ADD_DEFINITIONS(-Os -ggdb -Wall -Werror --std=gnu99 -Wmissing-declarations)
 
 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
 
-ADD_EXECUTABLE(fs-state fs-state.c
-               libfstools/mount_root.c
+ADD_LIBRARY(fstools SHARED
                libfstools/snapshot.c
                libfstools/extroot.c
-               libfstools/jffs2.c
+               libfstools/overlay.c
                libfstools/volume.c
                libfstools/mtd.c
                libfstools/mount.c
                libfstools/find.c)
-TARGET_LINK_LIBRARIES(fs-state ubox)
-INSTALL(TARGETS fs-state RUNTIME DESTINATION sbin)
+TARGET_LINK_LIBRARIES(fstools ubox)
+INSTALL(TARGETS fstools LIBRARY DESTINATION lib)
 
-ADD_EXECUTABLE(block block.c
+ADD_LIBRARY(blkid-tiny SHARED
                libblkid-tiny/libblkid-tiny.c
                libblkid-tiny/mkdev.c
                libblkid-tiny/ext.c
@@ -27,5 +26,29 @@ ADD_EXECUTABLE(block block.c
                libblkid-tiny/swap.c
                libblkid-tiny/ubifs.c
                libblkid-tiny/squashfs.c)
-TARGET_LINK_LIBRARIES(block uci ubox blobmsg_json)
+INSTALL(TARGETS blkid-tiny LIBRARY DESTINATION lib)
+
+ADD_LIBRARY(ubi-utils STATIC
+               libubi/libubi.c
+               libubi/libubi-tiny.c
+               libubi/ubiutils-common.c)
+
+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)
 INSTALL(TARGETS block RUNTIME DESTINATION sbin)
+
+ADD_EXECUTABLE(jffs2reset jffs2reset.c)
+TARGET_LINK_LIBRARIES(jffs2reset fstools)
+INSTALL(TARGETS jffs2reset RUNTIME DESTINATION sbin)
+
+ADD_EXECUTABLE(snapshot_tool snapshot.c)
+TARGET_LINK_LIBRARIES(snapshot_tool fstools)
+INSTALL(TARGETS snapshot_tool RUNTIME DESTINATION sbin)
+
+ADD_EXECUTABLE(ubi ubi.c)
+TARGET_LINK_LIBRARIES(ubi ubi-utils)
+INSTALL(TARGETS ubi RUNTIME DESTINATION sbin)