set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_FLAGS "-std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}")
set(CMAKE_BUILD_TYPE "Release")
//找库
find_package( OpenCV REQUIRED)
include_directories(
${OpenCV_INCLUDE_DIRS}
)
target_link_libraries(${PROJECT_NAME}
${OpenCV_LIBS}
)
//可执行文件
add_executable(SuperPointPretrainC++ SuperPointPretrainC++.cpp)
target_link_libraries(SuperPointPretrainC++ ${PROJECT_NAME})
target_link_libraries(SuperPointPretrainC++ "${TORCH_LIBRARIES}")
target_link_libraries(SuperPointPretrainC++ ${OpenCV_LIBS})
//为可执行文件添加动态链接库
FILE(GLOB_RECURSE shareObject /usr/local/lib/superpoint_share_lib/* )
target_link_libraries(SuperPointPretrainC++ ${shareObject})
//为可执行文件添加静态库
target_link_libraries(SuperPointPretrainC++ "${CMAKE_CURRENT_SOURCE_DIR}/lib/libcaculateDistance.a")
//输出信息
MESSAGE( STATUS "this var key = ${shareObject}.")
//打包静态库文件
add_library(${PROJECT_NAME}
src/SPextractor.cc
src/SuperPoint.cc
src/SuperPointMatch.cc
)
target_link_libraries(${PROJECT_NAME}
${TORCH_LIBRARIES}
${OpenCV_LIBS}
${EIGEN3_LIBS}
)
//解析src文件夹内容,添加到变量SRC_LIST中
aux_source_directory(./src SRC_LIST)