Update with improvements from testing in couresilient

This commit is contained in:
2026-02-28 05:07:06 -04:00
parent 846f6afb2b
commit 7ae1fe6b3b
2 changed files with 21 additions and 5 deletions

View File

@@ -63,15 +63,28 @@ function(_cppbessot_require_npx_package_executable npx_executable package_execut
# - No return value; raises FATAL_ERROR if execution fails.
execute_process(
COMMAND "${npx_executable}" --no-install "${package_executable}" --help
RESULT_VARIABLE _exec_result
RESULT_VARIABLE _help_result
OUTPUT_QUIET
ERROR_VARIABLE _exec_stderr
ERROR_VARIABLE _help_stderr
)
if(NOT _exec_result EQUAL 0)
if(_help_result EQUAL 0)
return()
endif()
# Some CLIs return non-zero for --help; verify with version as fallback.
execute_process(
COMMAND "${npx_executable}" --no-install "${package_executable}" version
RESULT_VARIABLE _version_result
OUTPUT_QUIET
ERROR_VARIABLE _version_stderr
)
if(NOT _version_result EQUAL 0)
message(FATAL_ERROR
"${package_executable} is not available through npx. "
"Ensure the supplying package is installed locally or globally. "
"Underlying error: ${_exec_stderr}")
"Help check error: ${_help_stderr}\nVersion check error: ${_version_stderr}")
endif()
endfunction()
@@ -98,6 +111,9 @@ function(cppbessot_check_dependencies)
_cppbessot_require_program(CPPBESSOT_GIT_EXECUTABLE git
"Install Git and ensure it is available in PATH.")
_cppbessot_require_npm_package("${CPPBESSOT_NPM_EXECUTABLE}" "@openapitools/openapi-generator-cli")
_cppbessot_require_npx_package_executable("${CPPBESSOT_NPX_EXECUTABLE}" "@openapitools/openapi-generator-cli")
_cppbessot_require_npm_package("${CPPBESSOT_NPM_EXECUTABLE}" "openapi-zod-client")
_cppbessot_require_npx_package_executable("${CPPBESSOT_NPX_EXECUTABLE}" "openapi-zod-client")

View File

@@ -20,7 +20,7 @@ function(cppbessot_add_db_gen_zod_target version)
add_custom_target(db_gen_zod
COMMAND ${CMAKE_COMMAND} -E make_directory "${_output_dir}"
COMMAND "${CPPBESSOT_NPX_EXECUTABLE}" --no-install openapi-zod-client
--input "${_openapi_file}"
"${_openapi_file}"
--output "${_output_file}"
--export-schemas
COMMENT "Generating Zod schemas for ${version}"