11# --- 1. Define Paths ---
2- set (CAN_DIR "${CMAKE_CURRENT_LIST_DIR} " )
2+ set (CAN_DIR "${CMAKE_CURRENT_LIST_DIR} " )
33set (YAML_INPUT "${CAN_DIR} /Doc/format.CANdo" )
4- set (INC_DIR "${CAN_DIR} /Inc" )
4+ set (INC_DIR "${CAN_DIR} /Inc" )
55set (SCRIPT_DIR "${CAN_DIR} /Src" )
66
77# error handling
88function (run_can_parser script_name output_file)
9- execute_process (
10- COMMAND perl "${SCRIPT_DIR} /${script_name} " "${YAML_INPUT} " "${INC_DIR} /${output_file} "
11- RESULT_VARIABLE result
12- ERROR_VARIABLE error_output
13- )
14-
15- if (NOT result EQUAL 0)
16- message (FATAL_ERROR
17- "\n [CANfigurator] FAILED to run ${script_name} \n "
18- "Exit Code: ${result} \n "
19- "Error Message: ${error_output} \n "
20- )
21- endif ()
9+ execute_process (
10+ COMMAND
11+ perl "${SCRIPT_DIR} /${script_name} " "${YAML_INPUT} "
12+ "${INC_DIR} /${output_file} "
13+ RESULT_VARIABLE result
14+ ERROR_VARIABLE error_output
15+ )
16+
17+ if (NOT result EQUAL 0)
18+ message (
19+ FATAL_ERROR
20+ "\n [CANfigurator] FAILED to run ${script_name} \n "
21+ "Exit Code: ${result} \n "
22+ "Error Message: ${error_output} \n "
23+ )
24+ endif ()
2225endfunction ()
2326
2427function (run_perl_files)
25- run_can_parser("CANdlerparser.pl" "CANDler.h" )
26- run_can_parser("CANparser.pl" "Custom_CAN_ID.h" )
27- run_can_parser("GRparser.pl" "GR_IDS.h" )
28- run_can_parser("MSGparser.pl" "can_msg_ids.h" )
28+ run_can_parser("CANdlerparser.pl" "CANDler.h" )
29+ run_can_parser("CANparser.pl" "Custom_CAN_ID.h" )
30+ run_can_parser("GRparser.pl" "GR_IDS.h" )
31+ run_can_parser("MSGparser.pl" "can_msg_ids.h" )
2932endfunction ()
3033
3134# --- 3. Execute Commands --
32- execute_process (COMMAND mkdir -p "${INC_DIR} " )
35+ execute_process (
36+ COMMAND
37+ mkdir -p "${INC_DIR} "
38+ )
3339
3440message (STATUS "CANfigurator: Generating headers in ${INC_DIR} " )
3541
@@ -38,8 +44,4 @@ run_perl_files()
3844# --- 4. The Interface Library ---
3945add_library (CANfigurator INTERFACE )
4046
41- target_include_directories (
42- CANfigurator
43- INTERFACE
44- "${INC_DIR} "
45- )
47+ target_include_directories (CANfigurator INTERFACE "${INC_DIR} " )
0 commit comments