Skip to content

Commit

Permalink
Add Findonnxruntime.cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
GiulioRomualdi committed Apr 12, 2023
1 parent d619a19 commit 7172fa3
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions cmake/Findonnxruntime.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# SPDX-FileCopyrightText: 2023 Giulio Romualdi
# SPDX-License-Identifier: BSD-3-Clause

#[=======================================================================[.rst:
Findonnxruntime
-----------
The following imported targets are created:
onnxruntime::onnxruntime
#]=======================================================================]

include(FindPackageHandleStandardArgs)

find_path(onnxruntime_INCLUDE_DIR
NAMES onnxruntime_c_api.h)
mark_as_advanced(onnxruntime_INCLUDE_DIR)
find_library(onnxruntime_LIBRARY
NAMES onnxruntime)
mark_as_advanced(onnxruntime_LIBRARY)
mark_as_advanced(onnxruntime_LIBRARY)

find_package_handle_standard_args(onnxruntime DEFAULT_MSG onnxruntime_INCLUDE_DIR onnxruntime_LIBRARY)

if(onnxruntime_FOUND)
if(NOT TARGET onnxruntime::onnxruntime)
add_library(onnxruntime::onnxruntime UNKNOWN IMPORTED)
set_target_properties(onnxruntime::onnxruntime PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${onnxruntime_INCLUDE_DIR}")
set_property(TARGET onnxruntime::onnxruntime PROPERTY
IMPORTED_LOCATION "${onnxruntime_LIBRARY}")
endif()
endif()

0 comments on commit 7172fa3

Please sign in to comment.