Add cmake option to select asn1c, and test asn1c parameters
CMake now takes the option ASN1C_EXEC to select an asn1c to use for compilation. For instance, run with cmake .. -GNinja -DASN1C_EXEC=/opt/asn1c/bin/asn1c or ./build_oai --cmake-opt -DASN1C_EXEC=/opt/asn1c/bin/asn1c to select the alternative asn1c. For instance, this is important for the CI to allow to build multiple versions of OAI in parallel that might use different commits of OAI. Further, this patch introduces functionality to check for the support of asn1c options that we require, and alerts the user if they are missing, alongside a message of how to resolve the problem.
This commit is contained in:
@@ -89,3 +89,21 @@ macro(eval_boolean VARIABLE)
|
||||
set(${VARIABLE} OFF)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
function(check_option EXEC TEST_OPTION EXEC_HINT)
|
||||
message(STATUS "Check if ${EXEC} supports ${TEST_OPTION}")
|
||||
execute_process(COMMAND ${EXEC} ${TEST_OPTION}
|
||||
RESULT_VARIABLE CHECK_STATUS
|
||||
OUTPUT_VARIABLE CHECK_OUTPUT
|
||||
ERROR_VARIABLE CHECK_OUTPUT)
|
||||
if(NOT ${CHECK_STATUS} EQUAL 1)
|
||||
get_filename_component(EXEC_FILE ${EXEC} NAME)
|
||||
message(FATAL_ERROR "Error message: ${CHECK_OUTPUT}\
|
||||
You might want to re-run ./build_oai -I
|
||||
Or provide a path to ${EXEC_FILE} using
|
||||
./build_oai ... --cmake-opt -D${EXEC_HINT}=/path/to/${EXEC_FILE}
|
||||
or directly with
|
||||
cmake .. -D${EXEC_HINT}=/path/to/${EXEC_FILE}
|
||||
")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
Reference in New Issue
Block a user