summaryrefslogtreecommitdiffstats
path: root/tools/CMakeLists.txt
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:54:46 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:54:46 +0000
commitcd7b005519ade8ab6c97fcb21590b71b7d1be6e3 (patch)
treec611a8d0cd5e8f68f41b8c2d16ba580e0f40a38d /tools/CMakeLists.txt
parentInitial commit. (diff)
downloadlibrtr-cd7b005519ade8ab6c97fcb21590b71b7d1be6e3.tar.xz
librtr-cd7b005519ade8ab6c97fcb21590b71b7d1be6e3.zip
Adding upstream version 0.8.0.upstream/0.8.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/CMakeLists.txt')
-rw-r--r--tools/CMakeLists.txt37
1 files changed, 37 insertions, 0 deletions
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
new file mode 100644
index 0000000..e101b49
--- /dev/null
+++ b/tools/CMakeLists.txt
@@ -0,0 +1,37 @@
+add_executable(rtrclient rtrclient.c ${mustach} ${tommyds})
+set_source_files_properties("${mustach}" PROPERTIES COMPILE_FLAGS "-DNO_EXTENSION_FOR_MUSTACH -DNO_OPEN_MEMSTREAM")
+set_source_files_properties("${tommyds}" PROPERTIES COMPILE_FLAGS "-Dtommy_malloc=malloc -Dtommy_calloc=calloc -Dtommy_realloc=realloc -Dtommy_free=free -include stdlib.h")
+target_link_libraries(rtrclient rtrlib)
+install(TARGETS rtrclient DESTINATION bin)
+install(FILES "rtrclient.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
+
+add_executable(rpki-rov rpki-rov.c)
+target_link_libraries(rpki-rov rtrlib)
+install(TARGETS rpki-rov DESTINATION bin)
+install(FILES "rpki-rov.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
+
+
+set(rtrclient_pfx_templates default csv csvwithheader json)
+
+# Generate escaped string sequence for every template file
+# This runs at configure time, changes are not picked up automatically
+foreach(template_name IN LISTS rtrclient_pfx_templates)
+ file(READ "templates/${template_name}" template_data HEX)
+ string(LENGTH "${template_data}" template_length)
+ math(EXPR template_length "${template_length} - 1")
+
+ set(TEMPLATES "${TEMPLATES}{ .name = \"${template_name}\", .template = \"")
+
+ foreach(iter RANGE 0 ${template_length} 2)
+ string(SUBSTRING ${template_data} ${iter} 2 line)
+ set(TEMPLATES "${TEMPLATES}\\x${line}")
+ endforeach()
+ set(TEMPLATES "${TEMPLATES} \"},\n")
+
+endforeach()
+
+string(STRIP ${TEMPLATES} TEMPLATES)
+
+CONFIGURE_FILE(templates.h.cmake templates.h)
+
+include_directories(${CMAKE_CURRENT_BINARY_DIR})