File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,9 @@ set_and_check(GGML_INCLUDE_DIR "@PACKAGE_GGML_INCLUDE_INSTALL_DIR@")
108108set_and_check(GGML_LIB_DIR "@PACKAGE_GGML_LIB_INSTALL_DIR@" )
109109#set_and_check(GGML_BIN_DIR "@PACKAGE_GGML_BIN_INSTALL_DIR@")
110110
111+ # Include the exported targets file
112+ include ("${CMAKE_CURRENT_LIST_DIR} /ggml-targets.cmake" )
113+
111114if (NOT TARGET ggml::ggml)
112115 find_package (Threads REQUIRED)
113116
Original file line number Diff line number Diff line change @@ -243,11 +243,21 @@ function(ggml_add_backend_library backend)
243243 # write the shared library to the output directory
244244 set_target_properties (${backend} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} )
245245 target_compile_definitions (${backend} PRIVATE GGML_BACKEND_DL)
246- add_dependencies (ggml ${backend} )
246+ # Do not add dependency, the User will have to explicitely build and install
247+ # the available `ggml::ggml-*` backend targets. This is for better integration
248+ # with cmake-bare
249+ # add_dependencies(ggml ${backend})
250+
247251 if (GGML_BACKEND_DIR)
248- install (TARGETS ${backend} LIBRARY DESTINATION ${GGML_BACKEND_DIR} )
252+ install (TARGETS ${backend}
253+ EXPORT ggml-targets
254+ LIBRARY DESTINATION ${GGML_BACKEND_DIR}
255+ RUNTIME DESTINATION ${GGML_BACKEND_DIR} )
249256 else ()
250- install (TARGETS ${backend} LIBRARY DESTINATION ${CMAKE_INSTALL_BINDIR} )
257+ install (TARGETS ${backend}
258+ EXPORT ggml-targets
259+ LIBRARY DESTINATION ${CMAKE_BINARY_DIR}
260+ RUNTIME DESTINATION ${CMAKE_BINARY_DIR} )
251261 endif ()
252262 else ()
253263 add_library (${backend} ${ARGN} )
You can’t perform that action at this time.
0 commit comments