我的同事在 QT 中编写了一个代码,其中包括
#include<QtWidgets>
我的任务是为所有构建的库和可执行文件编写 cmake 文件。
我收到一条错误消息,提示找不到标头。我知道如果我将其更改为具有 .h 扩展名的另一个标头,它将起作用,但是有没有办法让我不必更改他的任何代码并且仍然能够检测到这些包含?
cmake_minimum_required(VERSION 2.8)
PROJECT(myproject)
SET(CMAKE_CXX_FLAGS "-g -Wall")
SET(BUILD_SHARED_LIBS ON)
# Find the QtWidgets library
find_package(Qt5Widgets REQUIRED)
FIND_PACKAGE(OpenCV REQUIRED)
FIND_PACKAGE(Boost REQUIRED)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
SET(SRC
src/main.cpp
src/video_player.cpp
src/video_widget.cpp
src/video_widget_surface.cpp
)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
include_directories(${PROJECT_SOURCE_DIR}/include ${OpenCV_INCLUDE_DIRS} ${Qt_INCLUDE_DIRS})
add_executable(myproject ${SRC} ${myproject_HEADERS_MOC})