mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-13 04:30:28 +00:00
Encapsulate cmake asn1c call, suppress useless output
Encapsulate the asn1c call from cmake in a cmake function run_asn1c(). As a notable change to the previous manual add_custom_command() invocation, in suppresses the output of asn1c by default [1] and stores it in a log file. In case of asn1c4 error, the output will output on stdout. Use the new run_asn1c() in all occasions for code generation. [1] it is quite verbose, with many warnings that we cannot influence nor suppress, and lists all generated files which is verified by the build system automatically, anyway.
This commit is contained in:
@@ -107,3 +107,18 @@ or directly with
|
||||
")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(run_asn1c ASN1C_GRAMMAR ASN1C_PREFIX)
|
||||
set(options "")
|
||||
set(oneValueArgs COMMENT)
|
||||
set(multiValueArgs OUTPUT OPTIONS)
|
||||
cmake_parse_arguments(ASN1C "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
get_filename_component(GRAMMAR_FILE ${ASN1C_GRAMMAR} NAME)
|
||||
set(LOGFILE "${CMAKE_CURRENT_BINARY_DIR}/${GRAMMAR_FILE}.log")
|
||||
add_custom_command(OUTPUT ${ASN1C_OUTPUT}
|
||||
COMMAND ASN1C_PREFIX=${ASN1C_PREFIX} ${ASN1C_EXEC} ${ASN1C_OPTIONS} -D ${CMAKE_CURRENT_BINARY_DIR} ${ASN1C_GRAMMAR} > ${LOGFILE} 2>&1 || cat ${LOGFILE}
|
||||
DEPENDS ${ASN1C_GRAMMAR}
|
||||
COMMENT "Generating ${ASN1C_COMMENT} from ${GRAMMAR_FILE}"
|
||||
)
|
||||
endfunction()
|
||||
|
||||
Reference in New Issue
Block a user