CMakeLists配置

CMakeList配置

  1. #指定cmake的最小版本号
    CMAKE_MINIMUM_REQUIRED(VERSION 3.6.0)
  2. #指定项目名称
    PROJECT(PMTRTemp)
  3. #指定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)
  4. #引入Qt库
    FIND_PACKAGE(Qt5Widgets REQUIRED)
    FIND_PACKAGE(Qt5Gui REQUIRED)
    FIND_PACKAGE(Qt5Core REQUIRED)
  5. #设置文件的输出目录
    SET(OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
    SET(LIB_PATHEX ${PROJECT_SOURCE_DIR}/lib)
    SET(INCLUDE_PAHT ${PROJECT_SOURCE_DIR}/include)
  6. #添加子节点
    ADD_SUBDIRECTORY(PMTR)
    #ADD_SUBDIRECTORY(DBServer)
  7. #设置窗口程序对应的入口函数是Winmain,控制台程序对应的入口函数是 main
    #SET(CMAKE_EXE_LINKER_FLAGS “${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS”)
  8. #增加宏定义
    if(win32)
    ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
    endif(win32)
  9. #定义变量
    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)
  10. #工具链
    if(ARM)
    SET(CMAKE_CXX_COMPILER arm-linux-g++)
    SET(CMAKE_BUILD_TYPE “Debug”)
    SET(CMAKE_CXX_FLAGS_DEBUG “-g -ggdb”)#-O0 -Wall
    endif()
  11. #多核编译
    if(win32)
    SET_TARGET_PROPERTIES(PMTRTemp PROPERTIES COMPILE_FLAGS “/MP”)
    else(win32)
    endif(win32)

CMakeLists.rule

  1. SET(modulename ExtendUI)
  2. 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
    )
  3. 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
    )
  4. 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})
上一篇:Python图形界面学习记录4:pyqt5-tools找不到designer.exe


下一篇:StackExchange.Redis 官方文档