libtorch在linux clion环境中加入

cmake file

cmake_minimum_required(VERSION 3.12)
project(torch_test)

list(APPEND CMAKE_PREFIX_PATH “/home/shijue/LJH/libtorch”) #pytorch自动提示

find_package(Torch REQUIRED)

include_directories("/home/shijue/LJH/libtorch/include")
include_directories("/home/shijue/LJH/libtorch/include/torch/csrc/api/include")

add_executable(torch_test main.cpp)

target_link_libraries(torch_test “${TORCH_LIBRARIES}”)

set_property(TARGET torch_test PROPERTY CXX_STANDARD 14)

你可能感兴趣的:(linux,C++)