CMake使用Opencv

时间:2017-06-05 22:44:59

标签: c++ opencv cmake shared-libraries

我是CMake的新手。我想用OpenCV lib编译我的代码的共享库。这是我的CMakeLists文件

cmake_minimum_required(VERSION 3.7)
project(FM)

set(CMAKE_CXX_STANDARD 14)

find_package(OpenCV REQUIRED)

set(HEADER_FILES
        FeatureExtract2.h
        FeatureCompare2.h
        Matching.h
        Helper.h
        )

set(SOURCE_FILES
        FeatureExtract2.cpp
        FeatureCompare2.cpp
        Matching.cpp
        )

add_library(FM SHARED ${HEADER_FILES} ${SOURCE_FILES})
target_link_libraries(FM OpenCV_LIBS})

这是CMake错误: (target_link_libraries): Cannot specify link libraries for target "FM" which is not built by this project. 我在这做错了什么?非常感谢!

0 个答案:

没有答案