0

基本上我有一个文件夹/myOpenCVProject/

我在哪里:

header.hpp
main.cpp
helper.cpp

和 CMakeLists.txt

SET( PROJECT_NAME myOpenCVProject )
PROJECT( ${PROJECT_NAME} )
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
FIND_PACKAGE( OpenCV REQUIRED )
ADD_EXECUTABLE( ${PROJECT_NAME} main.cpp )
TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${OpenCV_LIBS} )

我如何告诉 CMake 也包含headerhelper文件?

4

1 回答 1

2

您只需将它们包含在ADD_EXECUTABLE命令中:

ADD_EXECUTABLE( ${PROJECT_NAME} main.cpp helper.cpp header.hpp)

有关完整的详细信息ADD_EXECUTABLE,请运行

cmake --help-command add_executable
于 2012-07-08T11:06:36.943 回答