From 239930b397ecf17aea3d90f1649e8a3327464c8e Mon Sep 17 00:00:00 2001 From: Ben Deane Date: Fri, 19 Jul 2024 10:53:07 -0600 Subject: [PATCH] :sparkles: Plumb extra arguments to `gen_str_catalog` --- cmake/string_catalog.cmake | 27 ++++++++++++++++++++++++--- test/CMakeLists.txt | 10 +++++++++- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/cmake/string_catalog.cmake b/cmake/string_catalog.cmake index e3c3203f..d3071903 100644 --- a/cmake/string_catalog.cmake +++ b/cmake/string_catalog.cmake @@ -1,7 +1,15 @@ function(gen_str_catalog) set(options FORGET_OLD_IDS) - set(oneValueArgs OUTPUT_CPP OUTPUT_XML OUTPUT_JSON GEN_STR_CATALOG - OUTPUT_LIB) + set(oneValueArgs + OUTPUT_CPP + OUTPUT_XML + OUTPUT_JSON + GEN_STR_CATALOG + OUTPUT_LIB + CLIENT_NAME + VERSION + GUID_ID + GUID_MASK) set(multiValueArgs INPUT_JSON INPUT_LIBS INPUT_HEADERS STABLE_JSON) cmake_parse_arguments(SC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) @@ -34,6 +42,18 @@ function(gen_str_catalog) if(SC_FORGET_OLD_IDS) set(FORGET_ARG "--forget_old_ids") endif() + if(SC_CLIENT_NAME) + set(CLIENT_NAME_ARG --client_name ${SC_CLIENT_NAME}) + endif() + if(SC_VERSION) + set(VERSION_ARG --version ${SC_VERSION}) + endif() + if(SC_GUID_ID) + set(GUID_ID_ARG --guid_id ${SC_GUID_ID}) + endif() + if(SC_GUID_MASK) + set(GUID_MASK_ARG --guid_mask ${SC_GUID_MASK}) + endif() add_custom_command( OUTPUT ${SC_OUTPUT_CPP} ${SC_OUTPUT_JSON} ${SC_OUTPUT_XML} @@ -42,7 +62,8 @@ function(gen_str_catalog) --json_input ${SC_INPUT_JSON} --cpp_headers ${SC_INPUT_HEADERS} --cpp_output ${SC_OUTPUT_CPP} --json_output ${SC_OUTPUT_JSON} --xml_output ${SC_OUTPUT_XML} --stable_json ${SC_STABLE_JSON} - ${FORGET_ARG} + ${FORGET_ARG} ${CLIENT_NAME_ARG} ${VERSION_ARG} ${GUID_ID_ARG} + ${GUID_MASK_ARG} DEPENDS ${UNDEFS} ${INPUT_JSON} ${SC_GEN_STR_CATALOG} ${SC_STABLE_JSON} COMMAND_EXPAND_LISTS) if(SC_OUTPUT_LIB) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e041e379..522ccf17 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -94,7 +94,15 @@ gen_str_catalog( STABLE_JSON log/stable_strings.json INPUT_HEADERS - log/catalog_enums.hpp) + log/catalog_enums.hpp + CLIENT_NAME + "test" + VERSION + "test version" + GUID_ID + "01234567-89ab-cdef-0123-456789abcdef" + GUID_MASK + "ffffffff-ffff-ffff-ffff-ffffffffffff") add_library(catalog_strings STATIC ${CMAKE_CURRENT_BINARY_DIR}/strings.cpp) target_link_libraries(catalog_strings PUBLIC cib)