cmake: add curl-optiontable, curl-listhelp, curl-listcats targets

To match autotools `optiontable`, `listhelp`, `listcats` targets.

Closes #20014
This commit is contained in:
Viktor Szakats
2025-12-18 02:33:31 +01:00
parent 7e2b15ee56
commit d7bde803ee
2 changed files with 25 additions and 0 deletions

View File

@@ -40,3 +40,19 @@ add_custom_target(generate-curl.1 ALL DEPENDS "${CURL_MANPAGE}")
if(NOT CURL_DISABLE_INSTALL)
install(FILES "${CURL_MANPAGE}" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
endif()
if(PERL_EXECUTABLE)
add_custom_target(curl-listhelp
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating src/tool_listhelp.c" VERBATIM USES_TERMINAL
COMMAND "${PERL_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/scripts/managen" -d "${CMAKE_CURRENT_SOURCE_DIR}" listhelp ${DPAGES}
> "${PROJECT_SOURCE_DIR}/src/tool_listhelp.c"
DEPENDS "${PROJECT_SOURCE_DIR}/scripts/managen" ${DPAGES}
)
add_custom_target(curl-listcats
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating help category constants for src/tool_help.h" VERBATIM USES_TERMINAL
COMMAND "${PERL_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/scripts/managen" listcats ${DPAGES}
DEPENDS "${PROJECT_SOURCE_DIR}/scripts/managen" ${DPAGES}
)
endif()

View File

@@ -346,3 +346,12 @@ if(CURL_ENABLE_EXPORT_TARGET)
NAMESPACE ${PROJECT_NAME}::
)
endif()
if(PERL_EXECUTABLE)
add_custom_target(curl-optiontable
COMMENT "Generating lib/easyoptions.c" VERBATIM USES_TERMINAL
COMMAND "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/optiontable.pl" < "${PROJECT_SOURCE_DIR}/include/curl/curl.h"
> "${PROJECT_SOURCE_DIR}/lib/easyoptions.c"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/optiontable.pl" "${PROJECT_SOURCE_DIR}/include/curl/curl.h"
)
endif()