CMake问题解决

CMake问题解决,第1张

一、常用功能

# 编码设置为utf-8
#-------------------------------------- -EnCode Set- ------------------------------------
#add_class="superseo">compile_options("$<$:/utf-8>")
#add_compile_options("$<$:/utf-8>")
# 头文件的全局变量(定义变量)
#-------------------------------------- -include path- --------------------------------------
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include/controls)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include/controlsManager)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include/system)

# 获取(定义变量)--源文件,头文件,资源文件,ui文件
#-------------------------------------- -source file- --------------------------------------
file(GLOB_RECURSE SOURCE_FILES
    ${PROJECT_SOURCE_DIR}/*.c*
    ${PROJECT_SOURCE_DIR}/include/controls/*.c*
    ${PROJECT_SOURCE_DIR}/include/controlsManager/*.c*
    ${PROJECT_SOURCE_DIR}/include/ID/*.c*
    ${PROJECT_SOURCE_DIR}/include/ISocket/*.c*
    ${PROJECT_SOURCE_DIR}/include/QrCode/*.c*
    ${PROJECT_SOURCE_DIR}/include/system/*.c*
    ${PROJECT_SOURCE_DIR}/include/easyUI/*.c*
)

file(GLOB_RECURSE HEADER_FILES
    ${PROJECT_SOURCE_DIR}/*.h*
    ${PROJECT_SOURCE_DIR}/include/controls/*.h*
    ${PROJECT_SOURCE_DIR}/include/controlsManager/*.h*
    ${PROJECT_SOURCE_DIR}/include/ID/*.h*
    ${PROJECT_SOURCE_DIR}/include/ISocket/*.h*
    ${PROJECT_SOURCE_DIR}/include/QrCode/*.h*
    ${PROJECT_SOURCE_DIR}/include/system/*.h*
    ${PROJECT_SOURCE_DIR}/lib/ic/*.h*
)

file(GLOB_RECURSE UI_FILES
    ${PROJECT_SOURCE_DIR}/*.ui
)

file(GLOB_RECURSE RESOURCE_FILES
    ${PROJECT_SOURCE_DIR}/*.qrc
)

# 打印(调试,使用变量)--变量值
#-------------------------------------- -debug- --------------------------------------
message(STATUS PROJECT_SOURCE_DIR   =  ${PROJECT_SOURCE_DIR})

# 设置需要编译的文件(定义变量)
set(PROJECT_SOURCES
    ${HEADER_FILES}
    ${SOURCE_FILES}
    ${UI_FILES}
    ${RESOURCE_FILES}
)

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1320514.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-11
下一篇 2022-06-11

发表评论

登录后才能评论

评论列表(0条)

保存