cmake: split usign bits into static library
authorPetr Štetiar <ynezz@true.cz>
Mon, 16 Dec 2019 13:29:57 +0000 (14:29 +0100)
committerPetr Štetiar <ynezz@true.cz>
Mon, 16 Dec 2019 13:29:57 +0000 (14:29 +0100)
So it could be reused easily in unit tests for example.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
CMakeLists.txt

index 78970d2632b5e3f931fc6be4a4da5d8b89ab03c6..443d79bd4e8be136b478e7026620db90a2935140 100644 (file)
@@ -28,13 +28,15 @@ IF(USE_RPATH)
        SET(CMAKE_MACOSX_RPATH 1)
 ENDIF()
 
-ADD_EXECUTABLE(ucert ucert.c usign-exec.c)
+ADD_LIBRARY(ucert_lib STATIC usign-exec.c)
+ADD_EXECUTABLE(ucert ucert.c)
+
 IF(UCERT_FULL)
        ADD_DEFINITIONS(-DUCERT_FULL)
-       TARGET_LINK_LIBRARIES(ucert ${ubox} ${blobmsg_json} ${json})
+       TARGET_LINK_LIBRARIES(ucert ucert_lib ${ubox} ${blobmsg_json} ${json})
 ELSE()
        ADD_DEFINITIONS(-DUCERT_STRIP_MESSAGES)
-       TARGET_LINK_LIBRARIES(ucert ${ubox})
+       TARGET_LINK_LIBRARIES(ucert ucert_lib ${ubox})
 ENDIF()
 
 INSTALL(TARGETS ucert RUNTIME DESTINATION bin)