gctl_graphic/CMakeLists.txt
2025-02-08 20:51:05 +08:00

40 lines
1.2 KiB
CMake
Raw Permalink 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_GRAPHIC VERSION 1.0)
# 添加配置配件编写的函数
include(CMakePackageConfigHelpers)
option(GCTL_GRAPHIC_GMT "Use the GMT library" ON)
option(GCTL_GRAPHIC_MATHGL "Use the MathGL2 library" OFF)
message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
message(STATUS "Install prefix: " ${CMAKE_INSTALL_PREFIX})
message(STATUS "Processor: " ${CMAKE_HOST_SYSTEM_PROCESSOR})
message(STATUS "[GCTL_GRAPHIC] Use the GMT library: " ${GCTL_GRAPHIC_GMT})
message(STATUS "[GCTL_GRAPHIC] Use the MathGL2 library: " ${GCTL_GRAPHIC_MATHGL})
find_package(GCTL REQUIRED)
message(STATUS "Found GCTL")
include_directories(${GCTL_INC_DIR})
if(GCTL_GRAPHIC_GMT)
find_package(GMT REQUIRED)
message(STATUS "Found GMT")
include_directories(${GMT_INC_DIR})
endif()
if(GCTL_GRAPHIC_MATHGL)
find_package(MathGL2 REQUIRED FLTK)
message(STATUS "MathGL2 Version: " ${MathGL2_VERSION})
include_directories(${MathGL2_INCLUDE_DIRS})
endif()
# 加入一个头文件配置让cmake对源码进行操作
configure_file(
"${PROJECT_SOURCE_DIR}/config.h.in"
"${PROJECT_SOURCE_DIR}/lib/graphic/gctl_graphic_config.h"
)
# 添加库源文件地址
add_subdirectory(lib)
add_subdirectory(example)