1 先找一个例程。里面用到halide。

这时会提示找不到package。

按照那个提示做就行。

2 把提前下载好的halide放到一个位置

3 然后设置一下那个Halide_DIR就可以了

set(Halide_DIR "${CMAKE_SOURCE_DIR}/your_path/Halide/")list(APPEND CMAKE_PREFIX_PATH ${Halide_DIR})

这种方法有个问题 就是不能找halide依赖的库,ZLIB,PNG,JPEG。

解决方法是

直接在那个cmake_prefix_path 里面多加上这一句

这样做就是慢一些

参考opencv库的make 方式

set(Opencv_root "${CMAKE_SOURCE_DIR}/your_path/opencv")set(Opencv_INCLUDE_DIRS "${Opencv_root}/include/")set(world_lib "${Opencv_root}/lib/release/opencv_world454.lib")set(world_d_lib "${Opencv_root}/lib/debug/opencv_world454d.lib")add_library(opencv::world UNKNOWN IMPORTED)set_target_properties(opencv::worldPROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${Opencv_INCLUDE_DIRS} IMPORTED_LOCATION_DEBUG "${world_d_lib}" IMPORTED_LOCATION_RELEASE "${world_lib}" IMPORTED_LOCATION_RELWITHDEBINFO "${world_lib}")set(libpng_lib "${Opencv_root}/lib/release/libpng.lib")set(libpng_d_lib "${Opencv_root}/lib/debug/libpngd.lib")add_library(opencv::libpng UNKNOWN IMPORTED)set_target_properties(opencv::libpngPROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${Opencv_INCLUDE_DIRS} IMPORTED_LOCATION_DEBUG ${libpng_d_lib} IMPORTED_LOCATION_RELEASE ${libpng_lib} IMPORTED_LOCATION_RELWITHDEBINFO "${libpng_lib}")set(zlib_lib "${Opencv_root}/lib/release/zlib.lib")set(zlib_d_lib "${Opencv_root}/lib/debug/zlibd.lib")add_library(opencv::zlib UNKNOWN IMPORTED)set_target_properties(opencv::zlibPROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${Opencv_INCLUDE_DIRS} IMPORTED_LOCATION_DEBUG ${zlib_d_lib} IMPORTED_LOCATION_RELEASE ${zlib_lib} IMPORTED_LOCATION_RELWITHDEBINFO "${zlib_lib}")set(libjpegturbo_lib "${Opencv_root}/lib/release/libjpeg-turbo.lib")set(libjpegturbo_d_lib "${Opencv_root}/lib/debug/libjpeg-turbod.lib")add_library(opencv::libjpegturbo UNKNOWN IMPORTED)set_target_properties(opencv::libjpegturboPROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${Opencv_INCLUDE_DIRS} IMPORTED_LOCATION_DEBUG ${libjpegturbo_d_lib} IMPORTED_LOCATION_RELEASE ${libjpegturbo_lib} IMPORTED_LOCATION_RELWITHDEBINFO "${libjpegturbo_lib}")set(libopenjp2_lib "${Opencv_root}/lib/release/libopenjp2.lib")set(libopenjp2_d_lib "${Opencv_root}/lib/debug/libopenjp2d.lib")add_library(opencv::libopenjp2 UNKNOWN IMPORTED)set_target_properties(opencv::libopenjp2PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${Opencv_INCLUDE_DIRS} IMPORTED_LOCATION_DEBUG ${libopenjp2_d_lib} IMPORTED_LOCATION_RELEASE ${libopenjp2_lib} IMPORTED_LOCATION_RELWITHDEBINFO "${libopenjp2_lib}")add_library(opencv INTERFACE IMPORTED)set_property(TARGET opencv PROPERTY INTERFACE_LINK_LIBRARIES opencv::world opencv::libpng opencv::zlib opencv::libjpegturbo opencv::libopenjp2)