switch to _DEFAULT_SOURCE for modern glibc compat
[project/procd.git] / CMakeLists.txt
index b90cdd7..98395f5 100644 (file)
@@ -14,13 +14,20 @@ SET(SOURCES procd.c signal.c watchdog.c state.c     inittab.c rcS.c ubus.c system.c
        service/service.c service/instance.c service/validate.c service/trigger.c service/watch.c
        plug/coldplug.c plug/hotplug.c utils/utils.c)
 
-find_library(json NAMES json-c json)
-SET(LIBS ubox ubus ${json} blobmsg_json json_script)
+SET(LIBS ubox ubus json-c blobmsg_json json_script)
 
 IF(DEBUG)
   ADD_DEFINITIONS(-DDEBUG -g3)
 ENDIF()
 
+IF(ZRAM_TMPFS)
+  ADD_DEFINITIONS(-DZRAM_TMPFS)
+  SET(SOURCES_ZRAM initd/zram.c)
+ENDIF()
+
+IF(BUILD_UPGRADED)
+  add_subdirectory(upgraded)
+ENDIF()
 
 ADD_EXECUTABLE(procd ${SOURCES})
 TARGET_LINK_LIBRARIES(procd ${LIBS})
@@ -29,7 +36,8 @@ INSTALL(TARGETS procd
 )
 
 
-ADD_EXECUTABLE(init initd/init.c initd/early.c initd/preinit.c initd/mkdev.c watchdog.c)
+ADD_EXECUTABLE(init initd/init.c initd/early.c initd/preinit.c initd/mkdev.c watchdog.c
+       utils/utils.c ${SOURCES_ZRAM})
 TARGET_LINK_LIBRARIES(init ${LIBS})
 INSTALL(TARGETS init
        RUNTIME DESTINATION sbin
@@ -42,14 +50,6 @@ INSTALL(TARGETS udevtrigger
 )
 
 
-ADD_EXECUTABLE(upgraded upgraded.c watchdog.c)
-TARGET_LINK_LIBRARIES(upgraded ubox.a rt.a -static -lc -lgcc)
-set_target_properties(upgraded PROPERTIES LINK_SEARCH_END_STATIC 1)
-INSTALL(TARGETS upgraded
-       RUNTIME DESTINATION sbin
-)
-
-
 ADD_EXECUTABLE(askfirst utils/askfirst.c)
 INSTALL(TARGETS askfirst
        RUNTIME DESTINATION sbin