File onnxruntime-dont-install-tests.patch of Package onnxruntime

diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 5555fa69..657e5b20 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -96,6 +96,7 @@ option(onnxruntime_USE_DNNL "Build with DNNL support" OFF)
 option(onnxruntime_USE_NEURAL_SPEED "Build with Neural Speed support" OFF)
 option(onnxruntime_USE_JSEP "Build with JavaScript implemented kernels support" OFF)
 option(onnxruntime_BUILD_UNIT_TESTS "Build ONNXRuntime unit tests" ON)
+option(onnxruntime_INSTALL_UNIT_TESTS "Install ONNXRuntime unit tests" ON)
 option(onnxruntime_BUILD_CSHARP "Build C# library" OFF)
 option(onnxruntime_BUILD_OBJC "Build Objective-C library" OFF)
 option(onnxruntime_USE_PREINSTALLED_EIGEN "Use pre-installed EIGEN. Need to provide eigen_SOURCE_PATH if turn this on." OFF)
diff --git a/cmake/onnxruntime_unittests.cmake b/cmake/onnxruntime_unittests.cmake
index 0c1e5e93..345fad36 100644
--- a/cmake/onnxruntime_unittests.cmake
+++ b/cmake/onnxruntime_unittests.cmake
@@ -1087,12 +1087,13 @@ if (NOT IOS)
         target_link_options(onnx_test_runner PRIVATE "/STACK:4000000")
       endif()
     endif()
-
-    install(TARGETS onnx_test_runner
-            ARCHIVE  DESTINATION ${CMAKE_INSTALL_LIBDIR}
-            LIBRARY  DESTINATION ${CMAKE_INSTALL_LIBDIR}
-            BUNDLE   DESTINATION ${CMAKE_INSTALL_LIBDIR}
-            RUNTIME  DESTINATION ${CMAKE_INSTALL_BINDIR})
+    if (onnxruntime_INSTALL_UNIT_TESTS)
+      install(TARGETS onnx_test_runner
+              ARCHIVE  DESTINATION ${CMAKE_INSTALL_LIBDIR}
+              LIBRARY  DESTINATION ${CMAKE_INSTALL_LIBDIR}
+              BUNDLE   DESTINATION ${CMAKE_INSTALL_LIBDIR}
+              RUNTIME  DESTINATION ${CMAKE_INSTALL_BINDIR})
+    endif()
 endif()
 
 if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
openSUSE Build Service is sponsored by