我的Cmakelists是这么的:
cmake_minimum_required(VERSION 2.8)
PROJECT (test)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
IF(NOT VTK_BINARY_DIR)
FIND_PACKAGE(VTK)
IF(NOT VTK_DIR)
MESSAGE(FATAL_ERROR "Please set VTK_DIR.")
ENDIF(NOT VTK_DIR)
INCLUDE(${VTK_USE_FILE})
ENDIF(NOT VTK_BINARY_DIR)
#find Qt
set (CMAKE_PREFIX_PATH "D:\\Toolkit\\Qt5.7.1\\5.7\\msvc2015_64")
FIND_PACKAGE(Qt5Widgets REQUIRED)
if("${VTK_QT_VERSION}" STREQUAL "")
message(FATAL_ERROR "VTK was not built with Qt")
endif()
# Use the include path and library for Qt that is used by VTK.
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${OPENCV_INCLUDE_DIR}
${Qt5Widgets_INCLUDES}
./UI
./Include
./Include/LibMWCapture
./Include/LibMWMedia
)
QT5_WRAP_UI(UISrcs UI/test.ui)
ADD_EXECUTABLE(test main.cpp test.cpp test.h )
TARGET_LINK_LIBRARIES(test
${VTK_LIBRARIES}
${Qt5Widgets_LIBRARIES}
)
Cmake过了,可是在VS里面却报缺少头文件!我感觉还是Cmake上有问题,又不知道问题到底在哪!