set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)

macro(add_example name switch)
	if(${switch})
		# 添加可执行程序名称
		add_executable(${name} ${name}.cpp)
		# 设置安装后的动态库调用地址
		set_target_properties(${name} PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
		set_target_properties(${name} PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON)
		target_link_libraries(${name} PRIVATE ${GCTL_LIB})
		target_link_libraries(${name} PRIVATE gctl_graphic)
	endif()
endmacro()

if(${GCTL_GRAPHIC_GMT})
	add_example(JX_single_ex ON)
endif()

if(${GCTL_GRAPHIC_MATHGL})
	add_example(mathgl_plot_ex ON)
	add_example(mathgl_dens_ex ON)
endif()