QT Cmake 示例模板
程序员文章站
2022-03-12 07:52:13
cmake_minimum_required(VERSION 2.8)project(appname)SET(SRC_LIST main.cxx/xx.c)# add (.h) addressinclude_directories(${PROJECT_SOURCE_DIR}/tools${PROJECT_SOURCE_DIR}/camera)# add l......
cmake_minimum_required(VERSION 2.8)
project(appname)
SET(SRC_LIST main.c
xx/xx.c
)
# add (.h) address
include_directories(${PROJECT_SOURCE_DIR}/xxx
)
# add lib address
link_directories(${PROJECT_SOURCE_DIR}/xxx
)
#编译为可执行文件
add_executable(${PROJECT_NAME} ${SRC_LIST})
#编译为动态库
#add_library(${PROJECT_NAME} SHARED ${SRC_LIST})
#编译为静态库
#add_library(${PROJECT_NAME} STATIC ${SRC_LIST})
add_definitions(-Wall -std=gnu99 -lm -pthread -lstdc++)
#添加自定义全局宏:define xxx
add_definitions(-Dxxx)
# 添加多线程
find_package(Threads)
target_link_libraries (${PROJECT_NAME} ${CMAKE_THREAD_LIBS_INIT})
# math 库
target_link_libraries(${PROJECT_NAME} m)
# 添加 libxxx.so
target_link_libraries(${PROJECT_NAME} xxx)
本文地址:https://blog.csdn.net/weixin_42549534/article/details/108576457