CMakeList配置
- #指定cmake的最小版本号
CMAKE_MINIMUM_REQUIRED(VERSION 3.6.0)- #指定项目名称
PROJECT(PMTRTemp)- #指定Qt路径和启用当前目录(按需设置)
SET(CMAKE_PREFIX_PATH $ENV{QTDIR512})
SET(QT_LIBRARIES Qt5::Core Qt5::Widgets Qt5::Gui Qt5::DBus Qt5::Sql Qt5::SerialPort Qt5::Multimedia Qt5::MultimediaWidgets Qt5::Charts Qt5::Xml Qt5::XmlPatterns Qt5::Script Qt5::ScriptTools Qt5::PrintSupport)- #引入Qt库
FIND_PACKAGE(Qt5Widgets REQUIRED)
FIND_PACKAGE(Qt5Gui REQUIRED)
FIND_PACKAGE(Qt5Core REQUIRED)- #设置文件的输出目录
SET(OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
SET(LIB_PATHEX ${PROJECT_SOURCE_DIR}/lib)
SET(INCLUDE_PAHT ${PROJECT_SOURCE_DIR}/include)- #添加子节点
ADD_SUBDIRECTORY(PMTR)
#ADD_SUBDIRECTORY(DBServer)- #设置窗口程序对应的入口函数是Winmain,控制台程序对应的入口函数是 main
#SET(CMAKE_EXE_LINKER_FLAGS “${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS”)- #增加宏定义
if(win32)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
endif(win32)- #定义变量
SET(CMAKE_BUILD_TYPE “Debug”)
if(win32)
set(PLATFORM win32)
set(APP_NAME ${PROJECT_NAME}d.exe)
set(SGX_LINK_PATH )
else(win32)
set(PLATFORM arm)
set(APP_NAME ${PROJECT_NAME})
endif(win32)- #工具链
if(ARM)
SET(CMAKE_CXX_COMPILER arm-linux-g++)
SET(CMAKE_BUILD_TYPE “Debug”)
SET(CMAKE_CXX_FLAGS_DEBUG “-g -ggdb”)#-O0 -Wall
endif()- #多核编译
if(win32)
SET_TARGET_PROPERTIES(PMTRTemp PROPERTIES COMPILE_FLAGS “/MP”)
else(win32)
endif(win32)
CMakeLists.rule
- SET(modulename ExtendUI)
- SET(${modulename}_moc_files
${modulename}/ExtendAuxiliayItem.h
${modulename}/ExtendChartView.h
${modulename}/ExtendCheckBoxDelegate.h
${modulename}/ExtendGraphicsSplineWgt.h
${modulename}/ExtendLineWgt.h
${modulename}/ExtendListWgtDelegate.h
${modulename}/ExtendPagenavigator.h
)- SET(${modulename}_source_files
${modulename}/ExtendAuxiliayItem.cpp
${modulename}/ExtendChartView.cpp
${modulename}/ExtendCheckBoxDelegate.cpp
${modulename}/ExtendGraphicsSplineWgt.cpp
${modulename}/ExtendLineWgt.cpp
${modulename}/ExtendListWgtDelegate.cpp
${modulename}/ExtendPagenavigator.cpp
)- SOURCE_GROUP(${modulename} FILES KaTeX parse error: Expected '}', got 'EOF' at end of input: {{modulename}_source_files} KaTeX parse error: Expected '}', got 'EOF' at end of input: {{modulename}_moc_files})