From 73dc992e027df37a1d0c778d4a42e9dc03bd57cd Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Sat, 5 Sep 2026 20:08:05 +0000 Subject: [PATCH] Fix in-tree builds by namespacing the emitFromONNX target When rootbench is built as part of ROOT itself, the emitFromONNX executable target clashed with the target of the same name defined by the SOFIE tests in tmva/sofie/test, aborting the CMake configuration: CMake Error at rootbench/root/tmva/sofie/CMakeLists.txt:67 (add_executable): add_executable cannot create target "emitFromONNX" because another target with the same name already exists. Rename the rootbench target to rootbench-emitFromONNX to keep the two builds out of each other's way. The tool is an internal build step, so nothing user-facing changes. --- root/tmva/sofie/CMakeLists.txt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/root/tmva/sofie/CMakeLists.txt b/root/tmva/sofie/CMakeLists.txt index 3a890803..e9703a95 100644 --- a/root/tmva/sofie/CMakeLists.txt +++ b/root/tmva/sofie/CMakeLists.txt @@ -63,10 +63,13 @@ set(sofie_models SimpleNN_Alice higgs_model_dense) -# Command line tool that generates the inference code for an ONNX model. -add_executable(emitFromONNX EmitFromONNX.cxx) -target_link_libraries(emitFromONNX Core ROOTTMVASofie ROOTTMVASofieParser) -set_target_properties(emitFromONNX PROPERTIES POSITION_INDEPENDENT_CODE TRUE) +# Command line tool that generates the inference code for an ONNX model. The +# target name is prefixed with "rootbench-" to avoid a clash with the +# emitFromONNX target of the SOFIE tests when rootbench is built as part of +# ROOT itself. +add_executable(rootbench-emitFromONNX EmitFromONNX.cxx) +target_link_libraries(rootbench-emitFromONNX Core ROOTTMVASofie ROOTTMVASofieParser) +set_target_properties(rootbench-emitFromONNX PROPERTIES POSITION_INDEPENDENT_CODE TRUE) set(model_dir ${CMAKE_CURRENT_BINARY_DIR}/input_models) set(model_generator ${CMAKE_CURRENT_SOURCE_DIR}/make_input_models.py) @@ -80,8 +83,8 @@ foreach(name ${sofie_models}) COMMENT "Generating ONNX model ${name}") add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${name}.hxx ${CMAKE_CURRENT_BINARY_DIR}/${name}.dat - COMMAND emitFromONNX ${model_dir}/${name}.onnx - DEPENDS emitFromONNX ${model_dir}/${name}.onnx + COMMAND rootbench-emitFromONNX ${model_dir}/${name}.onnx + DEPENDS rootbench-emitFromONNX ${model_dir}/${name}.onnx WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generating SOFIE inference code for ${name}") list(APPEND sofie_headers ${CMAKE_CURRENT_BINARY_DIR}/${name}.hxx)