gctl_mesh/CMakeLists.txt
2025-04-23 14:05:58 +08:00

44 lines
1.5 KiB
CMake
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

cmake_minimum_required(VERSION 3.15.2)
# 设置项目名称与语言
project(GCTL_MESH VERSION 2.0)
# 添加配置配件编写的函数
include(CMakePackageConfigHelpers)
# ExprTK库在macOS 15.4中编译会有错误 添加以下命令对应检查项
add_compile_options(-Wno-missing-template-arg-list-after-template-kw)
message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
message(STATUS "Install prefix: " ${CMAKE_INSTALL_PREFIX})
message(STATUS "Processor: " ${CMAKE_HOST_SYSTEM_PROCESSOR})
find_package(GCTL REQUIRED)
message(STATUS "GCTL Version: " ${GCTL_VERSION})
option(GCTL_MESH_EXPRTK "Use the exprtk library." ON)
option(GCTL_MESH_WAVELIB "Use the WaveLib library" ON)
# 传递安装地址给编译期宏变量
option(GCTL_MESH_INSTALL_PREFIX "Pass the install directory." ON)
set(DIR_VAR ${CMAKE_INSTALL_PREFIX})
message(STATUS "[GCTL_MESH] Pass the install directory: " ${GCTL_MESH_INSTALL_PREFIX})
message(STATUS "[GCTL_MESH] Use the exprtk library: " ${GCTL_MESH_EXPRTK})
message(STATUS "[GCTL_MESH] Use the WaveLib library: " ${GCTL_MESH_WAVELIB})
if(GCTL_MESH_WAVELIB)
if(NOT WaveLib_FOUND)
find_package(WaveLib REQUIRED)
message(STATUS "Found WaveLib")
include_directories(${WaveLib_INC_DIR})
endif()
endif()
# 加入一个头文件配置让cmake对源码进行操作
configure_file(
"${PROJECT_SOURCE_DIR}/config.h.in"
"${PROJECT_SOURCE_DIR}/lib/mesh/gctl_mesh_config.h"
)
# 添加库源文件地址
add_subdirectory(lib)
add_subdirectory(tool)
add_subdirectory(example)