CMake项目包括更多文件?

时间:2012-07-08 09:16:36

标签: visual-studio opencv cmake

基本上我有一个文件夹/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文件?

1 个答案:

答案 0 :(得分:2)

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

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

有关ADD_EXECUTABLE的完整详情,请运行

cmake --help-command add_executable