cmake

网址

官网(英文小字,看点头疼): https://cmake.org/cmake/help/cmake2.4docs.html

相关博客:

CMake 入门实战,从实例入手: https://blog.csdn.net/libaineu2004/article/details/78995740

常用参数

编译选择指定架构

arm64

cmake -DCMAKE_OSX_ARCHITECTURES=arm64 ..

x86_64

cmake -DCMAKE_OSX_ARCHITECTURES=x86_64 ..

Cmake 打印编译选项

记录

tegine cmake:

cmake_minimum_required(VERSION 3.6)
project(tengine)

aux_source_directory(. SRC_LIST)
aux_source_directory(./src/core SRC_LIST)
aux_source_directory(./src/event SRC_LIST)
aux_source_directory(./src/event/modules SRC_LIST)
aux_source_directory(./src/os/unix SRC_LIST)
aux_source_directory(./src/http SRC_LIST)
aux_source_directory(./src/http/modules SRC_LIST)

add_executable(${PROJECT_NAME} ${SRC_LIST})

INCLUDE_DIRECTORIES(./)
INCLUDE_DIRECTORIES(./src/core)
INCLUDE_DIRECTORIES(./src/event)
INCLUDE_DIRECTORIES(./src/event/modules)
INCLUDE_DIRECTORIES(./src/os/unix)
INCLUDE_DIRECTORIES(./src/http)
INCLUDE_DIRECTORIES(./src/http/modules)
INCLUDE_DIRECTORIES(./src/mail)

INCLUDE_DIRECTORIES(/opt/local/include)

TARGET_LINK_LIBRARIES (${PROJECT_NAME} /opt/local/lib/libpcre.a)
TARGET_LINK_LIBRARIES (${PROJECT_NAME} /opt/local/lib/libcrypto.a)
TARGET_LINK_LIBRARIES (${PROJECT_NAME} /opt/local/lib/libz.a)
支付宝打赏 微信打赏

来杯咖啡~

文章导航