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" ON)

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)